If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
KushBB
Posts: 374
Registered: ‎04-07-2010
My Device: Bold 9000
My Carrier: Airtel

Unknown Exception In Message Thread

Hello every one...

 

I am working on a task of sending a text message to  a specified phone number as soon as Phone is restarted after the SIM card has been changed...

 

I have used a check which calls a thread to call the send message function.

How ever as soon as that function is called, I get an exception which says "unknown(net...)" I dont know why this exception is coming as i have already used this function to send message earlier(2 weeks ago)

 

Heres my thread:

 

 

    static class CheckRequest extends Thread {
            public void run() {
            

                  ApplicationManager myApp = ApplicationManager.getApplicationManager();
                  while(myApp.inStartup()) {
                        try {
                               _thread.sleep(30000);
                        } catch(Exception e) {
                              // Catch Exception
                        }
                  }

               UiApplication.getUiApplication().invokeLater(new Runnable() {
                         public void run() {
                               
                               text = "SIM Has been Changed";
                               addr = "number";
            
                              if ( text.length() > 0 && addr.length() > 0)
                                        {   
                
                                            send(addr, text);
                                        }
                                }
              });
              
            }
}  

 and Exception Comes here:

 

 private static void send(String addr1, String text1)
    {    
        
        _sender.send(addr1, text1);
    }
    

 

 

 

 

Please Help...!!!

 

Thanks in Advance....

Press the Like button (Thumb up) on the left side to thank and
please mark the Thread as solved if its solved...
K.S
Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Unknown Exception In Message Thread

You probably need to make sure the phone is ready after a restart.  See this KB article for more:

 

http://supportforums.blackberry.com/t5/Java-Development/Detect-system-availability-on-startup/ta-p/4...

Please use plain text.
Developer
KushBB
Posts: 374
Registered: ‎04-07-2010
My Device: Bold 9000
My Carrier: Airtel

Re: Unknown Exception In Message Thread

Thanks for your reply Peter...

 

I will try and work it out and let you know....

 

Regards

Press the Like button (Thumb up) on the left side to thank and
please mark the Thread as solved if its solved...
K.S
Please use plain text.
Developer
KushBB
Posts: 374
Registered: ‎04-07-2010
My Device: Bold 9000
My Carrier: Airtel

Re: Unknown Exception In Message Thread

I tried as u told....

 

But I am getting same Exception at the same point...

 

This is what it says:

 

Exception thrown:@013D7400unknown(net_rim_cldc-1,57)
addr1@0A693000unknown(net_rim_cldc,73)
text1@0A695000unknown(net_rim_cldc,73)

Please Help!!!

 

 

 

Press the Like button (Thumb up) on the left side to thank and
please mark the Thread as solved if its solved...
K.S
Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Unknown Exception In Message Thread

Sorry I do not understand that error.

 

However having re-read your code, I realise that my csuggestrions was not correct, you were already doing it.

 

I do have a followup suggestion.  Before you start this Thread, do you actually have an application that you have used to

enterEventDisplatcher();

 

I think we need to see your main() processing and the place that you start this send Thread.

Please use plain text.
Developer
KushBB
Posts: 374
Registered: ‎04-07-2010
My Device: Bold 9000
My Carrier: Airtel

Re: Unknown Exception In Message Thread

Thanks for the Reply Peter...

 

Here's my main method and the thread starter:

 

 

 public static void main(String[] args)
    {
        
        
        System.out.println("main..............................................................................");
        System.out.println("main..............................................................................");
        System.out.println("main..............................................................................");
        
        Major theApp = new Major();
        
        
             
     
        theApp.enterEventDispatcher();
        
}




static {
   
storeP = PersistentStore.getPersistentObject(0xc74ec881fc9bfb84L);

synchronized (storeP) {
 
 try
    {   
        _password = (String)storeP.getContents();
      if (_password == null) {
        _password = GPRSInfo.imeiToString(SIMCardInfo.getIMSI());
        System.out.println(_password);
        storeP.setContents( _password );
        storeP.commit();
        }
      else {
            $imsiS = GPRSInfo.imeiToString(SIMCardInfo.getIMSI()) ;
            System.out.println(_password);
            System.out.println($imsiS);
    if (!_password.equals($imsiS)){
        
        
        _password = $imsiS;
        storeP.setContents(_password);
        storeP.commit();  
        _thread = new CheckRequest();
        _thread.start();
        }
    
}
}
catch (Exception e){
    System.out.println(e);
    }

}




}

 

PLZ HELP....

 

Press the Like button (Thumb up) on the left side to thank and
please mark the Thread as solved if its solved...
K.S
Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Unknown Exception In Message Thread

Sorry I have only briefly looked at this code, but wanted to get some feedback to you asap.

 

I don't actually like the way that you have used your static initializer - for example, I am not sure why you need to synchronize on the persistent object. 

 

Anyway, I would restructure this processing so that you move all this startup work into the

'startupWork()'

method, using this KB article.

http://supportforums.blackberry.com/t5/Java-Development/Detect-system-availability-on-startup/ta-p/4...

 

Can you do that and see if this resolves the problem?  Even if it doesn't, you have much nicer code!

Please use plain text.
Developer
KushBB
Posts: 374
Registered: ‎04-07-2010
My Device: Bold 9000
My Carrier: Airtel

Re: Unknown Exception In Message Thread

Thanks for the Reply Peter...

 

I will try and Let u know....

Do keep an Eye....  :smileyhappy:

 

Regards,

Press the Like button (Thumb up) on the left side to thank and
please mark the Thread as solved if its solved...
K.S
Please use plain text.