struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [3/3] git commit: WW-4055 Includes all jars by default
Date Thu, 07 Aug 2014 05:43:20 GMT
WW-4055 Includes all jars by default


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/dfb2bd3d
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/dfb2bd3d
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/dfb2bd3d

Branch: refs/heads/develop
Commit: dfb2bd3dbe8750ea9d98934cc5df1b61cac3516a
Parents: f1861ad
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Thu Aug 7 07:42:58 2014 +0200
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Thu Aug 7 07:42:58 2014 +0200

----------------------------------------------------------------------
 .../PackageBasedActionConfigBuilder.java        | 53 +++++++++-----------
 1 file changed, 23 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/dfb2bd3d/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
b/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
index b9b1a25..f6a43a8 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
@@ -93,7 +93,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
     private String[] actionPackages;
     private String[] excludePackages;
     private String[] packageLocators;
-    private String[] includeJars;
+    private String[] includeJars = new String[] { ".*?\\.jar(!/|/)?" };
     private String packageLocatorsBasePackage;
     private boolean disableActionScanning = false;
     private boolean disablePackageLocatorsScanning = false;
@@ -458,42 +458,35 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
         urlSet = urlSet.excludePaths(System.getProperty("sun.boot.class.path", ""));
         urlSet = urlSet.exclude(".*/JavaVM.framework/.*");
 
-        if (includeJars == null) {
-            urlSet = urlSet.exclude(".*?\\.jar(!/|/)?");
-        } else {
-            //jar urls regexes were specified
-            List<URL> rawIncludedUrls = urlSet.getUrls();
-            Set<URL> includeUrls = new HashSet<URL>();
-            boolean[] patternUsed = new boolean[includeJars.length];
-
-            for (URL url : rawIncludedUrls) {
-                if (fileProtocols.contains(url.getProtocol())) {
-                    //it is a jar file, make sure it macthes at least a url regex
-                    for (int i = 0; i < includeJars.length; i++) {
-                        String includeJar = includeJars[i];
-                        if (Pattern.matches(includeJar, url.toExternalForm())) {
-                            includeUrls.add(url);
-                            patternUsed[i] = true;
-                            break;
-                        }
+        List<URL> rawIncludedUrls = urlSet.getUrls();
+        Set<URL> includeUrls = new HashSet<URL>();
+        boolean[] patternUsed = new boolean[includeJars.length];
+
+        for (URL url : rawIncludedUrls) {
+            if (fileProtocols.contains(url.getProtocol())) {
+                //it is a jar file, make sure it macthes at least a url regex
+                for (int i = 0; i < includeJars.length; i++) {
+                    String includeJar = includeJars[i];
+                    if (Pattern.matches(includeJar, url.toExternalForm())) {
+                        includeUrls.add(url);
+                        patternUsed[i] = true;
+                        break;
                     }
-                } else {
-                    //it is not a jar
-                    includeUrls.add(url);
                 }
+            } else {
+                //it is not a jar
+                includeUrls.add(url);
             }
+        }
 
-            if (LOG.isWarnEnabled()) {
-                for (int i = 0; i < patternUsed.length; i++) {
-                    if (!patternUsed[i]) {
-                        LOG.warn("The includeJars pattern [#0] did not match any jars in
the classpath", includeJars[i]);
-                    }
+        if (LOG.isWarnEnabled()) {
+            for (int i = 0; i < patternUsed.length; i++) {
+                if (!patternUsed[i]) {
+                    LOG.warn("The includeJars pattern [#0] did not match any jars in the
classpath", includeJars[i]);
                 }
             }
-            return new UrlSet(includeUrls);
         }
-
-        return urlSet;
+        return new UrlSet(includeUrls);
     }
 
     /**


Mime
View raw message