[jboss-cvs] JBossAS SVN: r78755 - in projects/jboss-cl/trunk: classloading/src/main/java/org/jboss/classloading/spi/dependency/policy/mock and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Sep 22 10:38:29 EDT 2008


Author: alesj
Date: 2008-09-22 10:38:29 -0400 (Mon, 22 Sep 2008)
New Revision: 78755

Modified:
   projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/filter/PackageClassFilter.java
   projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/policy/mock/MockClassLoaderPolicyModule.java
Log:
[JBCL-32]; put back previous resource pattern behavior.

Modified: projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/filter/PackageClassFilter.java
===================================================================
--- projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/filter/PackageClassFilter.java	2008-09-22 14:18:46 UTC (rev 78754)
+++ projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/filter/PackageClassFilter.java	2008-09-22 14:38:29 UTC (rev 78755)
@@ -87,8 +87,8 @@
             // Base package - it is a match if there is no / in the path
             patterns[i] = "[^/]*";
          else
-            // Replace the dots with slashs and match non slashes after that, '/' at the end is optional
-            patterns[i] = packageNames[i].replace(".", "/") + "(/|/[^/]*)?";
+            // Replace the dots with slashs and match non slashes after that
+            patterns[i] = packageNames[i].replace(".", "/") + "/[^/]+";
       }
       return patterns;
    }

Modified: projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/policy/mock/MockClassLoaderPolicyModule.java
===================================================================
--- projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/policy/mock/MockClassLoaderPolicyModule.java	2008-09-22 14:18:46 UTC (rev 78754)
+++ projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/policy/mock/MockClassLoaderPolicyModule.java	2008-09-22 14:38:29 UTC (rev 78755)
@@ -149,19 +149,16 @@
     */
    protected void visitPath(File file, String path, ResourceVisitor visitor, ResourceFilter filter, ClassLoader classLoader, Collection<String> included, ClassFilter includedFilter, Collection<String> excluded, ClassFilter excludedFilter)
    {
-      if (included.isEmpty() == false && included.contains(path) == false)
-         return;
-      if (includedFilter != null && includedFilter.matchesResourcePath(path) == false)
-         return;
-      if (excluded.isEmpty() == false && excluded.contains(path))
-         return;
-      if (excludedFilter != null && excludedFilter.matchesResourcePath(path))
-         return;
+      boolean visit = includePath(path, included, includedFilter, excluded, excludedFilter);
 
       URL url = getURL(path);
-      ResourceContext context = new DefaultResourceContext(url, path, classLoader);
-      if (filter == null || filter.accepts(context))
-         visitor.visit(context);
+      
+      if (visit)
+      {
+         ResourceContext context = new DefaultResourceContext(url, path, classLoader);
+         if (filter == null || filter.accepts(context))
+            visitor.visit(context);
+      }
 
       if (file == null)
          file = getFile(url);
@@ -183,6 +180,30 @@
       }
    }
 
+   /**
+    * Should we include path in visit.
+    *
+    * @param path the path
+    * @param included the included
+    * @param includedFilter the included filter
+    * @param excluded the excluded
+    * @param excludedFilter the excluded filter
+    * @return true if path should be included in visit
+    */
+   protected boolean includePath(String path, Collection<String> included, ClassFilter includedFilter, Collection<String> excluded, ClassFilter excludedFilter)
+   {
+      if (included.isEmpty() == false && included.contains(path) == false)
+         return false;
+      if (includedFilter != null && includedFilter.matchesResourcePath(path) == false)
+         return false;
+      if (excluded.isEmpty() == false && excluded.contains(path))
+         return false;
+      if (excludedFilter != null && excludedFilter.matchesResourcePath(path))
+         return false;
+
+      return true;
+   }
+
    @Override
    protected List<Capability> determineCapabilities()
    {




More information about the jboss-cvs-commits mailing list