[testng] 164/355: fix jar scanning for <packages> element in testng.xml suite description (do not include subpackages if not recursive)

Eugene Zhukov eugene-guest at moszumanska.debian.org
Tue Aug 18 10:20:00 UTC 2015


This is an automated email from the git hooks/post-receive script.

eugene-guest pushed a commit to annotated tag OpenBSD
in repository testng.

commit 84a155a8aefdfa32796b3dfed8964bdf4bd097f4
Author: Stas Gromov <s.gromov at hh.ru>
Date:   Mon Mar 16 18:21:39 2015 +0300

    fix jar scanning for <packages> element in testng.xml suite description (do not include subpackages if not recursive)
---
 .gitignore                                          |  1 +
 src/main/java/org/testng/internal/PackageUtils.java | 10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index c30969b..c01cd55 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@ src/test/java/test/ignore
 .idea
 testng.iml
 .ant-targets*
+nb-configuration.xml
diff --git a/src/main/java/org/testng/internal/PackageUtils.java b/src/main/java/org/testng/internal/PackageUtils.java
index a4cc7fc..2703eb7 100644
--- a/src/main/java/org/testng/internal/PackageUtils.java
+++ b/src/main/java/org/testng/internal/PackageUtils.java
@@ -30,7 +30,7 @@ public class PackageUtils {
   private static String[] s_testClassPaths;
 
   /** The additional class loaders to find classes in. */
-  private static final List<ClassLoader> m_classLoaders = new Vector<ClassLoader>();
+  private static final List<ClassLoader> m_classLoaders = new Vector<>();
 
   /** Add a class loader to the searchable loaders. */
   public static void addClassLoader(final ClassLoader loader) {
@@ -58,9 +58,9 @@ public class PackageUtils {
     String packageDirName = packageOnly.replace('.', '/') + (packageOnly.length() > 0 ? "/" : "");
 
 
-    Vector<URL> dirs = new Vector<URL>();
+    Vector<URL> dirs = new Vector<>();
     // go through additional class loaders
-    Vector<ClassLoader> allClassLoaders = new Vector<ClassLoader>();
+    Vector<ClassLoader> allClassLoaders = new Vector<>();
     ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
     if (contextClassLoader != null) {
       allClassLoaders.add(contextClassLoader);
@@ -111,9 +111,9 @@ public class PackageUtils {
               packageName = name.substring(0, idx).replace('/', '.');
             }
 
-            Utils.log("PackageUtils", 4, "Package name is " + packageName);
-            if ((idx != -1) || recursive) {
+            if (recursive || packageName.equals(packageOnly)) {
               //it's not inside a deeper dir
+              Utils.log("PackageUtils", 4, "Package name is " + packageName);
               if (name.endsWith(".class") && !entry.isDirectory()) {
                 String className = name.substring(packageName.length() + 1, name.length() - 6);
                 Utils.log("PackageUtils", 4, "Found class " + className + ", seeing it if it's included or excluded");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/testng.git



More information about the pkg-java-commits mailing list