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: 61
Registered: ‎05-21-2009
My Device: Not Specified

Uncaught exception:java lang Error when upgrading the OS from 4.x to 5

Hi all

           I have an application running in appsore. Now the people who where upgrading the Operating System from 4 to 5. they are getting an error like this  'Uncaught exception:java lang Error'. The application  uses some database to store the values.

After OS upgrade the customers can't open the application it says Uncaught exception:java lang Error. Can anyone tell the solution to figure this out.

 

I have another question too.. when we are upgrading the os will the database clear by default ?.. because im my application the data were stored will not remain after upgrade

 

Thanks and Regards

 

Joe

Developer
Posts: 562
Registered: ‎09-30-2009
My Device: Not Specified

Re: Uncaught exception:java lang Error when upgrading the OS from 4.x to 5

Determine where the exception occurs and show us some code around where this happens, as well as a stack trace if possible.

Developer
Developer
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: Uncaught exception:java lang Error when upgrading the OS from 4.x to 5

If you are storeing your database in the persistent store, then it will be erased on an OS upgrade.

Developer
Posts: 61
Registered: ‎05-21-2009
My Device: Not Specified

Re: Uncaught exception:java lang Error when upgrading the OS from 4.x to 5

Thank you for your quick action

 

This is how i am storing the data in the persistance store...hope the error is throwing from this area

 

 

private static PersistentObject store;
static {
store = PersistentStore.getPersistentObject(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx);
synchronized (store) {
if (store.getContents() == null) {
store.setContents(new Vector());
store.commit();
}
}

 

Thanks in advance

 

Joe

Developer
Posts: 61
Registered: ‎05-21-2009
My Device: Not Specified

Re: Uncaught exception:java lang Error when upgrading the OS from 4.x to 5

Thank you for your quick action

 

I just wanted to know is there any way to keep the data when upgrading the OS.. There is an activation code for the applicatio.. so what the problem is when people updating the application ineed to give the key again.. After installing the OS when you click on the application the key and the database contents erasing..

 

Thanks in advance

 

Joe

Developer
Developer
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: Uncaught exception:java lang Error when upgrading the OS from 4.x to 5

For 3rd party apps, the data does not backup. I get around this by doing a double check on the activation code. I store the code in the persistent store, as well as an activation file hidden on the device. Since my keys are generated based on the PIN as long as they are not switching devices they can still get into the app. This also helps when users switch to anew device because if they use the Desktop Manager, then it will transfer all data on the device's internal memory. You can use this with a webservice to request a new pin for the device without user interaction. You will want to make sure this can only be done once per PIN so that they cannot move the file to another device just incase they find it.

Developer
Posts: 562
Registered: ‎09-30-2009
My Device: Not Specified

Re: Uncaught exception:java lang Error when upgrading the OS from 4.x to 5

Don't hope it comes from that part of code, *be sure*, otherwise you will not achieve anything.

 

The answer to your other question is if you're changing the data structure  of what you're persisting, you will need to read it back into your old data structure and convert it into your new one.

Developer
Posts: 32
Registered: ‎05-24-2009
My Device: Not Specified

Re: Uncaught exception:java lang Error when upgrading the OS from 4.x to 5

[ Edited ]

Related Problem

Developer
Posts: 61
Registered: ‎05-21-2009
My Device: Not Specified

Re: Uncaught exception:java lang Error when upgrading the OS from 4.x to 5

Hi,

 

The problem related to the initialization of the program.
The code is not modified yet, so there is no chance for changing the data structure.
The same code working without any problem in Version 5.0, but it happens only while upgrading the os. Then the previously installed application throws the error "uncaught exception java.lang error" while try to execute it

The data store initialized in a static block as bellow

static {
store = PersistentStore.getPersistentObject(0x____________ ______);
synchronized (store) {
if (store.getContents() == null) {
store.setContents(new Vector());
store.commit();
}
}
_data = new Vector();
_data = (Vector) store.getContents();
}

 

After up gradation of the OS there is there any possibility to run the application without executing this initialization block ?
(I am not sure about that).

I have already done the initialization process in main class like as follows and data store accessed in the constructor (MyAppClass).

public static void main(String[] args) {

MyAppClass app = new MyAppClass();
app.enterEventDispatcher();
}

 ================================================

 

Now we where modified the static  Initialization process in side the constructor and testing is in progress.

public static void main(String[] args) {
store = PersistentStore.getPersistentObject(0x____________ ______);
synchronized (store) {
if (store.getContents() == null) {

store.setContents(new Vector());
store.commit();
}
}
_data = new Vector();
_data = (Vector) store.getContents();
MyAppClass app = new MyAppClass();
app.enterEventDispatcher();
}

 

Will this block make any change
Have you any more idea about this ?(more about the data store init)
If so it is very helpful.