Found the problem in another part of code! I didn't close JsonParser before delete the associated file.. Calling close() has solved problem.
The exception was only on big files and only recently. Same code, time ago, give me no exception! 2013/1/22 Marco Serioli <[email protected]> > I have this piece of code that takes the server response and writes it > into a file. > > The file contains json data. I write response into file in order to scan > json sequentially and to avoid to load big json data in a List! > > public File getData(final String url) throws URISyntaxException, > AuthenticationException, IOException, ClientProtocolException, > HttpResponseException { > final HttpGet getRequest = new HttpGet(new URI(url)); > final UsernamePasswordCredentials creds = new > UsernamePasswordCredentials(username, password); > getRequest.addHeader(new BasicScheme().authenticate(creds, getRequest)); > getRequest.setHeader("Content-Type", "application/json"); > final ResponseHandler<byte[]> responseHandler = new > ByteArrayResponseHandler(); > final byte[] responseBody = mClient.execute(getRequest, responseHandler); > final File output = new File(FileConfig.TEMP_PATH + > System.currentTimeMillis()+".json"); > final FileOutputStream fos = new FileOutputStream(output.getPath()); > fos.write(responseBody); > fos.close(); > return output; > } > > But I've noticed that recently (I don't know why) I get this exception: > > 01-22 07:45:51.809: E/System(9055): Uncaught exception thrown by finalizer > 01-22 07:45:51.833: E/System(9055): java.io.IOException: close failed: > EIO (I/O error) > 01-22 07:45:51.833: E/System(9055): at > libcore.io.IoUtils.close(IoUtils.java:41) > 01-22 07:45:51.833: E/System(9055): at > java.io.FileInputStream.close(FileInputStream.java:121) > 01-22 07:45:51.833: E/System(9055): at > java.io.FileInputStream.finalize(FileInputStream.java:142) > 01-22 07:45:51.833: E/System(9055): at > java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:185) > 01-22 07:45:51.833: E/System(9055): at > java.lang.Daemons$FinalizerDaemon.run(Daemons.java:168) > 01-22 07:45:51.833: E/System(9055): at > java.lang.Thread.run(Thread.java:856) > 01-22 07:45:51.833: E/System(9055): Caused by: libcore.io.ErrnoException: > close failed: EIO (I/O error) > 01-22 07:45:51.833: E/System(9055): at libcore.io.Posix.close(Native > Method) > 01-22 07:45:51.833: E/System(9055): at > libcore.io.BlockGuardOs.close(BlockGuardOs.java:75) > 01-22 07:45:51.833: E/System(9055): at > libcore.io.IoUtils.close(IoUtils.java:38) > 01-22 07:45:51.833: E/System(9055): ... 5 more > 01-22 07:45:51.833: E/System(9055): Uncaught exception thrown by finalizer > 01-22 07:45:51.841: E/System(9055): java.io.IOException: close failed: EIO > (I/O error) > 01-22 07:45:51.841: E/System(9055): at > libcore.io.IoUtils.close(IoUtils.java:41) > 01-22 07:45:51.841: E/System(9055): at > java.io.FileInputStream.close(FileInputStream.java:121) > 01-22 07:45:51.841: E/System(9055): at > java.io.FileInputStream.finalize(FileInputStream.java:142) > 01-22 07:45:51.841: E/System(9055): at > java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:185) > 01-22 07:45:51.841: E/System(9055): at > java.lang.Daemons$FinalizerDaemon.run(Daemons.java:168) > 01-22 07:45:51.841: E/System(9055): at > java.lang.Thread.run(Thread.java:856) > 01-22 07:45:51.841: E/System(9055): Caused by: libcore.io.ErrnoException: > close failed: EIO (I/O error) > 01-22 07:45:51.841: E/System(9055): at libcore.io.Posix.close(Native > Method) > 01-22 07:45:51.841: E/System(9055): at > libcore.io.BlockGuardOs.close(BlockGuardOs.java:75) > 01-22 07:45:51.841: E/System(9055): at > libcore.io.IoUtils.close(IoUtils.java:38) > 01-22 07:45:51.841: E/System(9055): ... 5 more > > Everything seems to work, but I'm perplexed about this exception. > > The targetSdk ok my app is 13. > > Thanks for any comment / response! > Marco > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

