You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2016/12/27 13:34:55 UTC

svn commit: r1776127 - /jmeter/trunk/src/core/org/apache/jmeter/gui/util/MenuFactory.java

Author: pmouawad
Date: Tue Dec 27 13:34:55 2016
New Revision: 1776127

URL: http://svn.apache.org/viewvc?rev=1776127&view=rev
Log:
Sonar : Fix errors, vulnerabilities

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/util/MenuFactory.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/util/MenuFactory.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/util/MenuFactory.java?rev=1776127&r1=1776126&r2=1776127&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/util/MenuFactory.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/util/MenuFactory.java Tue Dec 27 13:34:55 2016
@@ -481,7 +481,7 @@ public final class MenuFactory {
 
                 boolean hideBean = false; // Should the TestBean be hidden?
 
-                JMeterGUIComponent item;
+                JMeterGUIComponent item = null;
                 try {
                     Class<?> c = Class.forName(name);
                     if (TestBean.class.isAssignableFrom(c)) {
@@ -492,18 +492,16 @@ public final class MenuFactory {
                         item = (JMeterGUIComponent) c.newInstance();
                     }
                 } catch (NoClassDefFoundError e) {
-                    log.warn("Missing jar? Could not create " + name + ". " + e);
+                    log.warn("Configuration error, probably corrupt or missing third party library(jar) ? Could not create class:" + name + ". " + e, 
+                            e);
                     continue;
-                } catch (Throwable e) {
-                    log.warn("Could not instantiate " + name, e);
-                    if (e instanceof Error){
-                        throw (Error) e;
-                    }
-                    if (e instanceof RuntimeException){
-                        if (!(e instanceof HeadlessException)) { // Allow headless testing
-                            throw (RuntimeException) e;
-                        }
-                    }
+                } catch(HeadlessException e) {
+                    log.warn("Could not instantiate class:" + name, e); // NOSONAR
+                    continue;
+                } catch(RuntimeException e) {
+                    throw (RuntimeException) e;
+                } catch (Exception e) {
+                    log.warn("Could not instantiate class:" + name, e); // NOSONAR
                     continue;
                 }
                 if (hideBean || elementsToSkip.contains(item.getStaticLabel())) {