Troubleshooting guide
152
BlackBerry Java Development Environment Development Guide
Replace a runtime object. 1. Invoke replace().
RuntimeStore store = RuntimeStore.getRuntimeStore();
String newmsg = "Some new text";
2. Create a try-catch block to manage the ControlledAccessException that replace()
throws if the runtime object with the specified ID does not exist.
try {
Object obj = store.replace( 0x60ac754bc0867248L, newmsg);
} catch(ControlledAccessException e) {
// Handle exception - insufficient permissions.
} not exist.
Retrieve a registered runtime object. 1. Invoke RuntimeStore.get() and provide as a parameter the runtime object ID.
RuntimeStore store = RuntimeStore.getRuntimeStore();
2. Create a try-catch block to manage the ControlledAccessException that get()
throws if the application does not have read access to the specified runtime object.
try {
// get() returns the objectm with the specified ID if it exists; null
// otherwise.
Object obj = store.get(0x60ac754bc0867248L);
} catch(ControlledAccessException e) {
// Handle exception.
}
Retrieve an unregistered runtime object. 1. Invoke RuntimeStore.waitFor() to wait for registration of a runtime object to complete.
If the runtime object with the specified ID does not exist, waitFor() blocks for a maximum of
MAX_WAIT_MILLIS.
RuntimeStore store = RuntimeStore.getRuntimeStore();
2. Create code for handling exceptions.
try {
Object obj = store.waitFor(0x60ac754bc0867248L);
} catch(ControlledAccessException e) {
// Handle exception - insufficient permissions.
} catch(RuntimeException e) {
// Handle exception - time out.
}
Task Steps