Strangely, Exception constructors that take a chained Exception didn't exist before API level 9 (though have always been in Java). Don't use them to avoid NoSuchMethodError on Froyo and earlier.

git-svn-id: https://zxing.googlecode.com/svn/trunk@2481 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2012-10-24 17:26:14 +00:00
parent eb2d89301f
commit 7b9eb7af63

View file

@ -104,11 +104,11 @@ public final class HttpHelper {
} 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);
throw new IOException(npe.toString());
} 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);
throw new IOException(iae.toString());
}
int responseCode;
try {
@ -116,7 +116,7 @@ public final class HttpHelper {
} 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);
throw new IOException(npe.toString());
}
if (responseCode != HttpURLConnection.HTTP_OK) {
throw new IOException("Bad HTTP response: " + responseCode);
@ -185,11 +185,11 @@ public final class HttpHelper {
} 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);
throw new IOException(npe.toString());
} 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);
throw new IOException(iae.toString());
}
int responseCode;
try {
@ -197,7 +197,7 @@ public final class HttpHelper {
} 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);
throw new IOException(npe.toString());
}
switch (responseCode) {
case HttpURLConnection.HTTP_MULT_CHOICE: