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
Posts: 218
Registered: ‎02-20-2009
My Device: Not Specified

Uncaught Exception: java.lang.NullPointerException when run application on device ?

Hi all,

 

 

I got Uncaught Exception: java.lang.NullPointerException  when run my application on device.

Application is signed.

JDE: 4.6.1

Simulator :8320

Device: Blackberry 8320

 

it working fine on simulator, but after code signing, when I install my application on device,

 

it throws the exception.

 

I couldnt understand the reason, please help me in this regard.

 

please ask If you needed more explanation/ information.

 

Thanks

Narendra

 

 

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Uncaught Exception: java.lang.NullPointerException when run application on device ?

* Attach the JDE/Eclipse JDE Plug-in debugger to your device and then start your application. The Debugger should show you where the error occurred.

 

* Have a look at the Event Log on the device (ALT + LGLG from the BlackBerry home screen). The stack trace of the NullPointerException is very likely to be in the log.

Developer
Posts: 218
Registered: ‎02-20-2009
My Device: Not Specified

Re: Uncaught Exception: java.lang.NullPointerException when run application on device ?

hi klyubin,

 

     when I attach to debugger, there is error message "Cannot find file         net_rim_app_manager.debug".

 

what should I do to remove this. ?

 

please.

 

Thanks for your quick reply.

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Uncaught Exception: java.lang.NullPointerException when run application on device ?

I think you can ignore these warnings. The way to fix them is to use a JDE version that matches the version of the handheld software on the device (excluding the last part of the version number -- e.g., JDE 4.6.1 for v4.6.1.x).
Developer
Posts: 218
Registered: ‎02-20-2009
My Device: Not Specified

Re: Uncaught Exception: java.lang.NullPointerException when run application on device ?

   

    I found that the java.lang.NullPointerException occurs when I used 

 

    Phone.getDevicePhoneNumber(true) in my  application.

 

   can anyone know the reason behind this.

 

 

Thanks.

narendra

 

 

 

 

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Uncaught Exception: java.lang.NullPointerException when run application on device ?

Is the NullPointerException coming from inside of Phone.getDevicePhoneNumber? If not, then, may be, you aren't checking for null being returned by the method (the javadoc for the method says it may return "... null if no phone number is currently available").
Developer
Posts: 52
Registered: ‎07-17-2008
My Device: Not Specified

Re: Uncaught Exception: java.lang.NullPointerException when run application on device ?

Straight from the RIM javadocs:

public static String getDevicePhoneNumber(boolean format)
retrieves the device's phone number if present

 

Pay attenion to the "if present" blurb. My guess is the method returns null if it's not present and elsewhere in your app you assume the value is not null. There are a number of reasons why the device would not support inspectingits phone numbe, most of them security related. Carriers can prevent access to protect customers from malicious apps, and I assume enterprise admins could likely do the same. In general, any features that interrogates the devicefor owner's sensative information (contact info, email, phone, etc.) can not be relied on.

New Developer
Posts: 1
Registered: ‎11-30-2009
My Device: Not Specified

Re: Uncaught Exception: java.lang.NullPointerException when run application on device ?

Plese moderator
Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Uncaught Exception: java.lang.NullPointerException when run application on device ?

?

 

Please what?