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: 19
Registered: ‎08-30-2009
My Device: Not Specified
Accepted Solution

Persistent Object Null Pointer Exception

Hi all! This is my first time trying to use persistent data and, following the Bberry tutorial, I'm getting a JVM 104 "NullPointer Exception" when trying to synchronize and "setContents" to a new persistent store (so basically my "PersistentObject" is Null (as confirmed in the debug), which I guess makes sense since I haven't stored any data to it yet. I guess I'm just curious as to why I'm getting this error (and cant just write something over the "null" value). Here is some code...

 

static PersistentObject levels =  PersistentStore.getPersistentObject(0x3e1f605d47578703L);

 

...

 

String[] level_info = {"0", "1"}; //just to test

 

            synchronized(levels) { //this is where I get the debug error of "NullPoint Exception", where levels = "null"

                    levels.setContents(level_info);
                    levels.commit();

           }

 

 

Thanks in advance for your help!

Highlighted
Developer
Posts: 19
Registered: ‎08-30-2009
My Device: Not Specified

Re: Persistent Object Null Pointer Exception

I've solved the issue by viewing the JDE 4.6 "samples" tutorial persistentstoredemo...

 

You can find it here on your PC:

 

C:\Program Files\Research In Motion\BlackBerry JDE 4.6.0\samples\com\rim\samples\device\persistentstoredemo

 

Thanks,

 

- Jordan