mirror of
https://gitee.com/shuto-github/cordova-plugin-network-information.git
synced 2026-04-22 00:00:02 +08:00
CB-11384 android: Does not pass sonarqube scan
The problem is "Empty Catch Block", which sonarqube considers a blocker. Added a log message to the empty block.
This commit is contained in:
committed by
Jesse MacFadyen
parent
83e870bf4e
commit
da7e85ec92
@@ -127,7 +127,9 @@ public class NetworkManager extends CordovaPlugin {
|
|||||||
String connectionType = "";
|
String connectionType = "";
|
||||||
try {
|
try {
|
||||||
connectionType = this.getConnectionInfo(info).get("type").toString();
|
connectionType = this.getConnectionInfo(info).get("type").toString();
|
||||||
} catch (JSONException e) { }
|
} catch (JSONException e) {
|
||||||
|
Log.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, connectionType);
|
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, connectionType);
|
||||||
pluginResult.setKeepCallback(true);
|
pluginResult.setKeepCallback(true);
|
||||||
@@ -171,7 +173,9 @@ public class NetworkManager extends CordovaPlugin {
|
|||||||
String connectionType = "";
|
String connectionType = "";
|
||||||
try {
|
try {
|
||||||
connectionType = thisInfo.get("type").toString();
|
connectionType = thisInfo.get("type").toString();
|
||||||
} catch (JSONException e) { }
|
} catch (JSONException e) {
|
||||||
|
Log.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
sendUpdate(connectionType);
|
sendUpdate(connectionType);
|
||||||
lastInfo = thisInfo;
|
lastInfo = thisInfo;
|
||||||
@@ -206,7 +210,9 @@ public class NetworkManager extends CordovaPlugin {
|
|||||||
try {
|
try {
|
||||||
connectionInfo.put("type", type);
|
connectionInfo.put("type", type);
|
||||||
connectionInfo.put("extraInfo", extraInfo);
|
connectionInfo.put("extraInfo", extraInfo);
|
||||||
} catch (JSONException e) { }
|
} catch (JSONException e) {
|
||||||
|
Log.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
return connectionInfo;
|
return connectionInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user