Hi,
When playing around with an Internet connection that downloads data asynchronously in the background and doing file operations in the foreground it can happen that the file handle gets closed unexpectedly by a Thread interruption on the Android runtime:
11-15 13:06:49.108 16722 16729 I MoSyncFile: maFileOpen (/data/data/com.mosync.app_mapctl/files//00000058.til, 3): 68 11-15 13:06:49.108 16722 16729 I MoSyncFile: maFileExists (68): true 11-15 13:06:49.108 16722 16729 I MoSyncFile: maFileTruncate (68) 11-15 13:06:49.108 16722 16729 I maWriteLog: fwrite (00198560, 30847, 1, 68) 11-15 13:06:49.108 16722 16729 I MoSyncFile: maFileWrite (68) 11-15 13:06:49.116 16722 16729 E MoSyncFile ERROR: writeByteBufferToFile Exception - java.nio.channels.ClosedByInterruptException 11-15 13:06:49.116 16722 16729 W System.err: java.nio.channels.ClosedByInterruptException 11-15 13:06:49.116 16722 16729 W System.err: at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:166) 11-15 13:06:49.116 16722 16729 W System.err: at org.apache.harmony.nio.internal.FileChannelImpl.writeImpl(FileChannelImpl.java:555) 11-15 13:06:49.116 16722 16729 W System.err: at org.apache.harmony.nio.internal.FileChannelImpl.write(FileChannelImpl.java:539) 11-15 13:06:49.116 16722 16729 W System.err: at com.mosync.internal.android.MoSyncFile.writeByteBufferToFile(MoSyncFile.java:596) 11-15 13:06:49.116 16722 16729 W System.err: at com.mosync.internal.android.MoSyncFile.maFileWrite(MoSyncFile.java:661) 11-15 13:06:49.116 16722 16729 W System.err: at com.mosync.internal.android.MoSyncThread.maFileWrite(MoSyncThread.java:3854) 11-15 13:06:49.116 16722 16729 W System.err: at com.mosync.internal.android.MoSyncThread.nativeRun(Native Method) 11-15 13:06:49.116 16722 16729 W System.err: at com.mosync.internal.android.MoSyncThread.run(MoSyncThread.java:902)
How do I handle this correctly? I have no possibility to check whether my file operation fails due to this exception so that I can retry everything, or if it is caused by another error which I probably can't handle by retrying.
Please advise.
Regards,
Ludwig