BUT SocketException is not the super-class for SocketTimeoutException, if not match the first clause(SocketException), it will match the sencond clause(SocketTimeoutException), isn't it?
2011/3/17 Kostya Vasilyev <[email protected]>: > Move the catch for SocketTimeoutException up, before the catch for > SocketException. The rule is, first match, not necessarily best match. > > 17.03.2011 6:39 пользователь "a a" <[email protected]> написал: >> Key code below: >> >> try { >> Xml.parse(operation.outBody, >> Xml.Encoding.UTF_8, parser); // Line 89 >> } catch (SocketException e) { >> Log.e(TAG, "getAlbumPhotos: " + e); >> ++syncResult.stats.numIoExceptions; >> e.printStackTrace(); >> return RESULT_ERROR; >> } catch (SocketTimeoutException e) { // why >> SocketTimeoutException can't be catched there????? >> Log.e(TAG, "getAlbumPhots: " + e); >> ++syncResult.stats.numIoExceptions; >> e.printStackTrace(); >> return RESULT_ERROR; >> } >> >> >> >> 01:00:50 E/AndroidRuntime(935): FATAL EXCEPTION: SyncAdapterThread-1 >> >> java.lang.AssertionError: java.net.SocketTimeoutException >> >> at android.util.Xml.parse(Xml.java:89) >> >> at com.cooliris.picasa.PicasaApi.getAlbumPhotos(PicasaApi.java:293) >> >> at >> com.cooliris.picasa.PicasaContentProvider.syncAlbumPhotos(PicasaContentProvider.java:400) >> >> at >> com.cooliris.picasa.PicasaContentProvider.syncUserPhotos(PicasaContentProvider.java:362) >> >> at >> com.cooliris.picasa.PicasaContentProvider.syncUsersAndAlbums(PicasaContentProvider.java:185) >> >> at >> com.cooliris.picasa.PicasaService.performSyncImpl(PicasaService.java:177) >> >> at com.cooliris.picasa.PicasaService.performSync(PicasaService.java:113) >> >> at >> com.cooliris.picasa.PicasaSyncAdapter.onPerformSync(PicasaSyncAdapter.java:74) >> >> at >> android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:164) >> >> Caused by: java.net.SocketTimeoutException >> >> at >> org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:461) >> >> at >> org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:85) >> >> at >> org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:103) >> >> at >> org.apache.http.impl.io.AbstractSessionInputBuffer.read(AbstractSessionInputBuffer.java:134) >> >> at >> org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:161) >> >> at >> org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:175) >> >> at >> org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:178) >> >> at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:225) >> >> at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:178) >> >> at java.util.zip.GZIPInputStream.read(GZIPInputStream.java:174) >> >> at java.io.FilterInputStream.read(FilterInputStream.java:133) >> >> at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:516) >> >> at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:479) >> >> at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:318) >> >> at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:275) >> >> at android.util.Xml.parse(Xml.java:87) >> >> ... 8 more >> >> -- >> 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 -- 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

