mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
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:
parent
4c57b3673c
commit
3edf7a57cc
|
@ -156,6 +156,8 @@ public final class HttpHelper {
|
||||||
in.close();
|
in.close();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
// continue
|
// continue
|
||||||
|
} catch (NullPointerException npe) {
|
||||||
|
// another apparent Android / Harmony bug; continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +191,15 @@ public final class HttpHelper {
|
||||||
Log.w(TAG, "Bad URI? " + uri);
|
Log.w(TAG, "Bad URI? " + uri);
|
||||||
throw new IOException(iae);
|
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_MULT_CHOICE:
|
||||||
case HttpURLConnection.HTTP_MOVED_PERM:
|
case HttpURLConnection.HTTP_MOVED_PERM:
|
||||||
case HttpURLConnection.HTTP_MOVED_TEMP:
|
case HttpURLConnection.HTTP_MOVED_TEMP:
|
||||||
|
|
|
@ -82,15 +82,14 @@ public final class WifiConfigManager extends AsyncTask<WifiParsedResult,Object,O
|
||||||
changeNetworkUnEncrypted(wifiManager, theWifiResult);
|
changeNetworkUnEncrypted(wifiManager, theWifiResult);
|
||||||
} else {
|
} else {
|
||||||
String password = theWifiResult.getPassword();
|
String password = theWifiResult.getPassword();
|
||||||
if (password == null || password.length() == 0) {
|
if (password != null && password.length() != 0) {
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
if (networkType == NetworkType.WEP) {
|
if (networkType == NetworkType.WEP) {
|
||||||
changeNetworkWEP(wifiManager, theWifiResult);
|
changeNetworkWEP(wifiManager, theWifiResult);
|
||||||
} else if (networkType == NetworkType.WPA) {
|
} else if (networkType == NetworkType.WPA) {
|
||||||
changeNetworkWPA(wifiManager, theWifiResult);
|
changeNetworkWPA(wifiManager, theWifiResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue