Friday, January 14, 2011

IOException with RecordStoreNotOpenException on RmsStorage.save() after RmsStorage.deleteAll()

If you see java.io.IOException caused by javax.microedition.rms.RecordStoreNotOpenException thrown while executing a save() in your J2ME Polish app, running for example in the Java ME emulator or also on real devices (BlackBerry, etc.), then you may be encountering the following problem.  Check if you have called deleteAll() previously.  RmsStorage (improperly, it seems) closes out the underlying record store when it performs a deleteAll(), so that subsequent calls to save() do not work.  If you do want to use deleteAll() to clear an old RmsStorage instance, the only solution I know of is to use a different instance after clearing the old one.

No comments:

Copyright 2011 by William Cain