Github user vlsi commented on a diff in the pull request:

    https://github.com/apache/jmeter/pull/181#discussion_r58370745
  
    --- Diff: src/core/org/apache/jmeter/util/JMeterUtils.java ---
    @@ -311,20 +315,47 @@ public void initializeProperties(String file) {
          * The output array always starts with
          * JMETER_HOME/lib/ext
          * and is followed by any paths obtained from the "search_paths" 
JMeter property.
    -     * 
    +     *
          * @return array of path strings
          */
         public static String[] getSearchPaths() {
             String p = JMeterUtils.getPropDefault("search_paths", null); // 
$NON-NLS-1$
    -        String[] result = new String[1];
    +        List<String> result = new LinkedList<>();
    +        result.add(getJMeterHome() + "/lib/ext"); // $NON-NLS-1$
     
    +        // add from property
             if (p != null) {
    -            String[] paths = p.split(";"); // $NON-NLS-1$
    -            result = new String[paths.length + 1];
    -            System.arraycopy(paths, 0, result, 1, paths.length);
    +            Collections.addAll(result, p.split(";")); // $NON-NLS-1$
    +        }
    +
    +        // add from thirdparty
    +        addThirdpartyPaths(result);
    +
    +        return result.toArray(new String[0]);
    +    }
    +
    +    private static void addThirdpartyPaths(List<String> result) {
    +        File thirdpartyRoot = new File(jmDir + File.separator + "lib" + 
File.separator + "3rdparty");
    +        File[] thirdpartyDirs = thirdpartyRoot.listFiles(new FileFilter() {
    +            @Override
    +            public boolean accept(File pathname) {
    +                return pathname.isDirectory();
    +            }
    +        });
    +
    +        if (thirdpartyDirs != null) {
    +            for (File libDir : thirdpartyDirs) {
    +                File[] libJars = libDir.listFiles(new FilenameFilter() {
    +                    @Override
    +                    public boolean accept(File dir, String name) {
    +                        return name.endsWith(".jar");// $NON-NLS-1$
    +                    }
    +                });
    +                for (File libJar : libJars) {
    --- End diff --
    
    libJars might throw NPE. Please check for `listFiles != null`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to