Author: pmouawad
Date: Fri Feb 16 20:42:01 2018
New Revision: 1824557

URL: http://svn.apache.org/viewvc?rev=1824557&view=rev
Log:
Bug 62110 - A broken junit class (due to missing dependency) breaks JMeter menus
Contributed by UbikLoadPack
Bugzilla Id: 62110

Modified:
    jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java?rev=1824557&r1=1824556&r2=1824557&view=diff
==============================================================================
--- jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java 
(original)
+++ jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java Fri 
Feb 16 20:42:01 2018
@@ -452,9 +452,7 @@ public final class ClassFinder {
                     String strEntry = entries.nextElement().toString();
                     if (strEntry.endsWith(DOT_CLASS)) {
                         String fixedClassName = fixClassName(strEntry);
-                        if (filter.accept(fixedClassName)) {
-                            listClasses.add(fixedClassName);
-                        }
+                        applyFiltering(listClasses, filter, fixedClassName);
                     }
                 }
             } catch (IOException e) {
@@ -481,10 +479,25 @@ public final class ClassFinder {
                 String className = path.substring(strPathElement.length() + 1,
                         path.lastIndexOf('.')) // $NON-NLS-1$
                         .replace(File.separator.charAt(0), '.');// $NON-NLS-1$
-                if (filter.accept(className)) {
-                    listClasses.add(className);
-                }
+                applyFiltering(listClasses, filter, className);
+            }
+        }
+    }
+
+    /**
+     * Run {@link ClassFilter#accept(String)} on className and add to 
listClasses if accept returns true
+     * In case of Throwable, className will not be added 
+     * @param classesSet Set of class names
+     * @param filter {@link ClassFilter}
+     * @param className Full class name
+     */
+    private static void applyFiltering(Set<String> classesSet, ClassFilter 
filter, String className) {
+        try {
+            if (filter.accept(className)) {
+                classesSet.add(className);
             }
+        } catch (Throwable e) { // NOSONAR : We need to trap also Errors
+            log.error("Error filtering class {}, it will be ignored", 
className, e);
         }
     }
 

Modified: jmeter/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1824557&r1=1824556&r2=1824557&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Fri Feb 16 20:42:01 2018
@@ -165,6 +165,7 @@ Summary
 <h3>General</h3>
 <ul>
   <li><bug>62107</bug>JMeter fails to start under Windows when 
<code>JM_LAUNCH</code> contains spaces</li>
+  <li><bug>62110</bug>A broken junit class (due to missing dependency) breaks 
JMeter menus. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
 </ul>
 
  <!--  =================== Thanks =================== -->
@@ -176,6 +177,7 @@ Summary
     <li>Graham Russell (graham at ham1.co.uk)</li>
     <li>orimarko at gmail.com</li>
     <li>Davide Angelocola (davide.angelocola at fisglobal.com)</li>
+    <li><a href="https://ubikloadpack.com";>Ubik Load Pack</a></li>
 </ul>
 <p>We also thank bug reporters who helped us improve JMeter.</p>
 <p>


Reply via email to