CB-11381 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 closes #169
This commit is contained in:
parent
aef8b9947b
commit
bcdc0b9da0
@ -142,8 +142,11 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
Method iuw = Config.class.getMethod("isUrlWhiteListed", String.class);
|
Method iuw = Config.class.getMethod("isUrlWhiteListed", String.class);
|
||||||
shouldAllowNavigation = (Boolean)iuw.invoke(null, url);
|
shouldAllowNavigation = (Boolean)iuw.invoke(null, url);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
|
Log.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
|
Log.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
|
Log.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (shouldAllowNavigation == null) {
|
if (shouldAllowNavigation == null) {
|
||||||
@ -153,8 +156,11 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
Method san = pm.getClass().getMethod("shouldAllowNavigation", String.class);
|
Method san = pm.getClass().getMethod("shouldAllowNavigation", String.class);
|
||||||
shouldAllowNavigation = (Boolean)san.invoke(pm, url);
|
shouldAllowNavigation = (Boolean)san.invoke(pm, url);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
|
Log.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
|
Log.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
|
Log.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// load in webview
|
// load in webview
|
||||||
@ -933,8 +939,11 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
Method gpm = webView.getClass().getMethod("getPluginManager");
|
Method gpm = webView.getClass().getMethod("getPluginManager");
|
||||||
pluginManager = (PluginManager)gpm.invoke(webView);
|
pluginManager = (PluginManager)gpm.invoke(webView);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
|
Log.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
|
Log.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
|
Log.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pluginManager == null) {
|
if (pluginManager == null) {
|
||||||
@ -942,7 +951,9 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
Field pmf = webView.getClass().getField("pluginManager");
|
Field pmf = webView.getClass().getField("pluginManager");
|
||||||
pluginManager = (PluginManager)pmf.get(webView);
|
pluginManager = (PluginManager)pmf.get(webView);
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException e) {
|
||||||
|
Log.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
|
Log.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user