Swallow another weird Android HTTP lib exception; use the proper IOException constructor now that we're on API 9+; don't log unuseful messages about obscure errors

git-svn-id: https://zxing.googlecode.com/svn/trunk@2898 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen@gmail.com 2013-10-10 15:08:32 +00:00
parent 6d7a77d73f
commit 21500405d5
3 changed files with 12 additions and 13 deletions

View file

@ -200,7 +200,7 @@ public final class HttpHelper {
} catch (NullPointerException npe) {
// Another strange bug in Android?
Log.w(TAG, "Bad URI? " + url);
throw new IOException(npe.toString());
throw new IOException(npe);
}
if (!(conn instanceof HttpURLConnection)) {
throw new IOException();
@ -213,31 +213,30 @@ public final class HttpHelper {
connection.connect();
} catch (NullPointerException npe) {
// this is an Android bug: http://code.google.com/p/android/issues/detail?id=16895
Log.w(TAG, "Bad URI? " + uri);
throw new IOException(npe.toString());
throw new IOException(npe);
} catch (IllegalArgumentException iae) {
// Also seen this in the wild, not sure what to make of it. Probably a bad URL
Log.w(TAG, "Bad URI? " + uri);
throw new IOException(iae.toString());
throw new IOException(iae);
} catch (SecurityException se) {
// due to bad VPN settings?
Log.w(TAG, "Restricted URI? " + uri);
throw new IOException(se.toString());
throw new IOException(se);
} catch (IndexOutOfBoundsException ioobe) {
// Another Android problem? https://groups.google.com/forum/?fromgroups#!topic/google-admob-ads-sdk/U-WfmYa9or0
Log.w(TAG, "Bad URI? " + uri);
throw new IOException(ioobe.toString());
throw new IOException(ioobe);
}
try {
return connection.getResponseCode();
} catch (NullPointerException npe) {
// this is maybe this Android bug: http://code.google.com/p/android/issues/detail?id=15554
Log.w(TAG, "Bad URI? " + uri);
throw new IOException(npe.toString());
throw new IOException(npe);
} catch (IllegalArgumentException iae) {
// Again seen this in the wild for bad header fields in the server response! or bad reads
Log.w(TAG, "Bad server status? " + uri);
throw new IOException(iae.toString());
throw new IOException(iae);
} catch (StringIndexOutOfBoundsException sioobe) {
// Another Android bug: https://code.google.com/p/android/issues/detail?id=18856
throw new IOException(sioobe);
}
}

View file

@ -120,7 +120,7 @@ final class AmazonInfoRetriever extends SupplementalInfoRetriever {
}
} catch (XmlPullParserException xppe) {
throw new IOException(xppe.toString());
throw new IOException(xppe);
}
if (error || detailPageURL == null) {

View file

@ -88,7 +88,7 @@ final class BookResultInfoRetriever extends SupplementalInfoRetriever {
}
} catch (JSONException e) {
throw new IOException(e.toString());
throw new IOException(e);
}
Collection<String> newTexts = new ArrayList<String>();