tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: be more tolerant with shades - also a workaround for xbean
Date Tue, 05 May 2015 17:25:19 GMT
Repository: tomee
Updated Branches:
  refs/heads/master 87a2991de -> ddc521585


be more tolerant with shades - also a workaround for xbean


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

Branch: refs/heads/master
Commit: ddc521585db2fbe5884a8b253b9c8025ce3dc277
Parents: 87a2991
Author: Romain Manni-Bucau <rmannibucau@apache.org>
Authored: Tue May 5 19:25:10 2015 +0200
Committer: Romain Manni-Bucau <rmannibucau@apache.org>
Committed: Tue May 5 19:25:10 2015 +0200

----------------------------------------------------------------------
 .../openejb/config/DeploymentsResolver.java     | 22 +++++++++++++++++++-
 .../src/main/resources/default.exclusions       |  1 +
 .../org/apache/tomee/embedded/Container.java    | 13 +++++++-----
 3 files changed, 30 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/ddc52158/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java
b/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java
index bf0f75c..73d783e 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java
@@ -33,6 +33,7 @@ import org.apache.xbean.finder.filter.IncludeExcludeFilter;
 import java.io.File;
 import java.io.FileFilter;
 import java.io.IOException;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -400,9 +401,28 @@ public class DeploymentsResolver implements DeploymentFilterable {
             return urls;
         }
 
+        private UrlSet cleanUpUrlSet(final UrlSet set) {
+            if (set.size() >= 5) { // if set size == 1 then we use both getURLs() and
getresource(META-INF) to find jar, ensure we don't duplicate it, ie size ~ 2
+                return set;
+            }
+
+            final List<URL> copy = set.getUrls();
+            for (final URL url : set.getUrls()) {
+                try {
+                    if ("file".equals(url.getProtocol()) && copy.contains(new URL("jar:"
+ url.toExternalForm() + "!"))) {
+                        copy.remove(url);
+                    }
+                } catch (final MalformedURLException e) {
+                    // no-op
+                }
+            }
+            return new UrlSet(copy);
+        }
+
         public ClasspathSearcher loadUrls(final ClassLoader classLoader) {
             try {
-                urlSet = URLs.cullSystemJars(new UrlSet(classLoader));
+                final UrlSet original = cleanUpUrlSet(new UrlSet(classLoader));
+                urlSet = URLs.cullSystemJars(original);
 
                 // save the prefiltered list of jars before excluding system apps
                 // so that we can choose not to filter modules with descriptors on the full
list

http://git-wip-us.apache.org/repos/asf/tomee/blob/ddc52158/container/openejb-core/src/main/resources/default.exclusions
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/resources/default.exclusions b/container/openejb-core/src/main/resources/default.exclusions
index 93d7a87..8022110 100644
--- a/container/openejb-core/src/main/resources/default.exclusions
+++ b/container/openejb-core/src/main/resources/default.exclusions
@@ -103,6 +103,7 @@ jansi-
 jasper.jar
 jasper-el.jar
 jasypt-
+java-atk-wrapper
 javaee-
 javaee-api
 javassist-

http://git-wip-us.apache.org/repos/asf/tomee/blob/ddc52158/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java b/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java
index 00b7eb2..a685f66 100644
--- a/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java
+++ b/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java
@@ -212,12 +212,15 @@ public class Container implements AutoCloseable {
         webModule.setRarUrls(Collections.<URL>emptyList());
         webModule.setScannableUrls(jarList);
         try {
+            final String filterContainerClasses = SystemInstance.get().getProperty("tomee.embedded.filter-container-classes");
             webModule.setFinder(
-                new FinderFactory.OpenEJBAnnotationFinder(
-                    // skip container classes in scanning for shades
-                    new WebappAggregatedArchive(webModule, jarList,
-                            jarList.size() == 1 ? new ContainerClassesFilter(configuration.getProperties())
/* shade */ : null))
-                        .link());
+                    new FinderFactory.OpenEJBAnnotationFinder(
+                            // skip container classes in scanning for shades
+                            new WebappAggregatedArchive(webModule, jarList,
+                                    // see org.apache.openejb.config.DeploymentsResolver.ClasspathSearcher.cleanUpUrlSet()
+                                    jarList.size() <= 4 || "true".equalsIgnoreCase(filterContainerClasses)
?
+                                            new ContainerClassesFilter(configuration.getProperties())
/* shade */ : null))
+                            .link());
         } catch (final Exception e) {
             throw new IllegalArgumentException(e);
         }


Mime
View raw message