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

Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: NullPointerException in a strange place

[ Edited ]

Don't feel bad about that NPE in the ObjectChoiceField - it happens to me too.  It is really low down in RIM code when it happens too, I think the ObjectChoiceField is trying to figure out the widest thing it has to display and works through the possible choices doing a .toString().length() for each Object choice.


Glad this is sorted, it was bugging me.


Re your debugging problem, I have JDE 4.6, 4.5, 4.3, 4.2.1, 4.2, etc. and J2SE Dev Kit 5.0_14, JRE 5.0_14, Java 2 Runtime SE 1.4.2_16 and Java 2 SDK, SE v1.4.2_16.  Everything seems to work fine on my XP SP3 machine, including the Beta 4.6 which, in theory, requires a later level of Java (haven't tried the real 4.6 yet).  The older Level of Java is required to support the older JDEs I have.


So I can't see why you can't debug.  If you machine is low powered and or has little memory, that might explain why the sim takes so long to load.  Give it another go and wait.

Message Edited by peter_strange on 09-11-2008 09:15 PM
New Developer
Posts: 15
Registered: ‎09-01-2008
My Device: Not Specified

Re: NullPointerException in a strange place

I ran it again and waited a while and it said it could not find the debug file, even though I clearly see the .debug file.  Apparently that .debug file is not the correct one?
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: NullPointerException in a strange place

Good point, you are going to find out how little I know now.......


If you are debugging in the JDE, then you start the simulator with the correct level of *.debug files for the OS, because they came packaged with the related *.cod files.  So when you get the Break points etc. it knows how to display OS type Objects, so you can see inside a System Object, like all the Strings.


Normally you also developing in that JDE, so you recompile your cods, creating the correct *debug files.  So, if you do development with only one JDE, then you never have any problems. 


Oh if life was only this simple.


But then you try to connect your device.  It probably has a different level of OS (later level than your JDE of course).  So now, when you are debugging, you don't have the correct levels of the Rim *.debug files and you can't see inside the various Rim objects.  To warn you that this is going to happen, you get the missing debug files message popup - which you just ignore with 'don't show me this again' checked.  You an still debug to a degree. 


You can also get it if you do what I tend to do, and just copy the cod files around when I'm swapping from one simulator to another.  Only this time, the cod file being identified in the popup message is one of mine.


In both cases, what the message is really telling you is that you might not get to see inside all the Objects you want because the JDE doesn't know how to interpret them.  But you will still see all the primitives, and you can set break points in your own code (assuming that it has a matching *.debug file).  So it is still useful to do this debugging even with missing debug files.


Now you are going to ask, "how to I integrate my device into my JDE so I can properly debug on my device?".  Sorry, I don't know the answer.  I think, whenever this question is asked, the Rim folks will point you at the following KB article:


How To - Connect the JDE to a specified simulator bundle
Article Number: DB-00059  



There are a number of related articles in the KB, that might also help, have a look.  However I have never done it.


Hope this helps.

BlackBerry Development Advisor
Posts: 15,874
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: NullPointerException in a strange place

The steps in that article are valid for older releases.  However, current versions of the BlackBerry JDE and BlackBerry Simulators should to this automatically for you.  Once a BlackBerry Simulator has been installed, it should show up in the BlackBerry JDE as an available option to launch.  So just pick the BlackBerry Simulator that matches your BlackBerry model and handheld software version (seen under Options, About), launch it once so that it is the "current" simulator in the BlackBerry JDE, close it and then connect to your BlackBerry.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.