Bandages for misc. exceptions seen in the wild

git-svn-id: https://zxing.googlecode.com/svn/trunk@2459 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2012-10-17 07:59:12 +00:00
parent 4c57b3673c
commit 3edf7a57cc
2 changed files with 17 additions and 8 deletions

View file

@ -156,6 +156,8 @@ public final class HttpHelper {
in.close();
} catch (IOException ioe) {
// continue
} catch (NullPointerException npe) {
// another apparent Android / Harmony bug; continue
}
}
}
@ -189,7 +191,15 @@ public final class HttpHelper {
Log.w(TAG, "Bad URI? " + uri);
throw new IOException(iae);
}
switch (connection.getResponseCode()) {
int responseCode;
try {
responseCode = 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);
}
switch (responseCode) {
case HttpURLConnection.HTTP_MULT_CHOICE:
case HttpURLConnection.HTTP_MOVED_PERM:
case HttpURLConnection.HTTP_MOVED_TEMP:

View file

@ -82,13 +82,12 @@ public final class WifiConfigManager extends AsyncTask<WifiParsedResult,Object,O
changeNetworkUnEncrypted(wifiManager, theWifiResult);
} else {
String password = theWifiResult.getPassword();
if (password == null || password.length() == 0) {
throw new IllegalArgumentException();
}
if (networkType == NetworkType.WEP) {
changeNetworkWEP(wifiManager, theWifiResult);
} else if (networkType == NetworkType.WPA) {
changeNetworkWPA(wifiManager, theWifiResult);
if (password != null && password.length() != 0) {
if (networkType == NetworkType.WEP) {
changeNetworkWEP(wifiManager, theWifiResult);
} else if (networkType == NetworkType.WPA) {
changeNetworkWPA(wifiManager, theWifiResult);
}
}
}
return null;