The problems is that I am out of disk space on the internal memory so the write fails. I am having trouble handling it confidently as the exception gets dropped on the floor ( see http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.3_r1/android/app/ContextImpl.java#3169 ). The .commit() call will return false and I can use that to handle the write error but I dont know if the fail is from space issue or from something else.
How do I know what the commit failed with?
stack trace
06-29 20:01:17.507: WARN/ApplicationContext(19221): writeToFile: Got exception:
java.io.IOException: No space left on device
at org.apache.harmony.luni.platform.OSFileSystem.write(Native Method)
at dalvik.system.BlockGuard$WrappedFileSystem.write(BlockGuard.java:171)
at java.io.FileOutputStream.write(FileOutputStream.java:300)
at com.android.internal.util.FastXmlSerializer.flushBytes(FastXmlSerializer.java:212)
at com.android.internal.util.FastXmlSerializer.flush(FastXmlSerializer.java:233)
at com.android.internal.util.FastXmlSerializer.endDocument(FastXmlSerializer.java:183)
at com.android.internal.util.XmlUtils.writeMapXml(XmlUtils.java:185)
at android.app.ContextImpl$SharedPreferencesImpl.writeToFile(ContextImpl.java:3191)
at android.app.ContextImpl$SharedPreferencesImpl.access$800(ContextImpl.java:2756)
at android.app.ContextImpl$SharedPreferencesImpl$1.run(ContextImpl.java:3106)
at android.app.ContextImpl$SharedPreferencesImpl.enqueueDiskWrite(ContextImpl.java:3127)
at android.app.ContextImpl$SharedPreferencesImpl.access$100(ContextImpl.java:2756)
at android.app.ContextImpl$SharedPreferencesImpl$EditorImpl.commit(ContextImpl.java:3049)