From bcdc0b9da01862dacac554db5fd6836d6463c4cc Mon Sep 17 00:00:00 2001 From: Rob Close Date: Mon, 6 Jun 2016 14:13:21 -0400 Subject: [PATCH] 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 --- src/android/InAppBrowser.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index f105a62..30915dc 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -142,8 +142,11 @@ public class InAppBrowser extends CordovaPlugin { Method iuw = Config.class.getMethod("isUrlWhiteListed", String.class); shouldAllowNavigation = (Boolean)iuw.invoke(null, url); } catch (NoSuchMethodException e) { + Log.d(LOG_TAG, e.getLocalizedMessage()); } catch (IllegalAccessException e) { + Log.d(LOG_TAG, e.getLocalizedMessage()); } catch (InvocationTargetException e) { + Log.d(LOG_TAG, e.getLocalizedMessage()); } } if (shouldAllowNavigation == null) { @@ -153,8 +156,11 @@ public class InAppBrowser extends CordovaPlugin { Method san = pm.getClass().getMethod("shouldAllowNavigation", String.class); shouldAllowNavigation = (Boolean)san.invoke(pm, url); } catch (NoSuchMethodException e) { + Log.d(LOG_TAG, e.getLocalizedMessage()); } catch (IllegalAccessException e) { + Log.d(LOG_TAG, e.getLocalizedMessage()); } catch (InvocationTargetException e) { + Log.d(LOG_TAG, e.getLocalizedMessage()); } } // load in webview @@ -933,8 +939,11 @@ public class InAppBrowser extends CordovaPlugin { Method gpm = webView.getClass().getMethod("getPluginManager"); pluginManager = (PluginManager)gpm.invoke(webView); } catch (NoSuchMethodException e) { + Log.d(LOG_TAG, e.getLocalizedMessage()); } catch (IllegalAccessException e) { + Log.d(LOG_TAG, e.getLocalizedMessage()); } catch (InvocationTargetException e) { + Log.d(LOG_TAG, e.getLocalizedMessage()); } if (pluginManager == null) { @@ -942,7 +951,9 @@ public class InAppBrowser extends CordovaPlugin { Field pmf = webView.getClass().getField("pluginManager"); pluginManager = (PluginManager)pmf.get(webView); } catch (NoSuchFieldException e) { + Log.d(LOG_TAG, e.getLocalizedMessage()); } catch (IllegalAccessException e) { + Log.d(LOG_TAG, e.getLocalizedMessage()); } }