Author: rmannibucau
Date: Sun Nov 18 18:31:39 2012
New Revision: 1410950
URL: http://svn.apache.org/viewvc?rev=1410950&view=rev
Log:
avoid to (try to) deploy twice the same app is the unpack version and the
packaged one exist in apps
Modified:
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java
Modified:
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java?rev=1410950&r1=1410949&r2=1410950&view=diff
==============================================================================
---
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java
(original)
+++
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java
Sun Nov 18 18:31:39 2012
@@ -133,7 +133,7 @@ public class DeploymentsResolver impleme
final URL url = file.toURI().toURL();
if (jarList.contains(url)) continue;
- if (file.getName().endsWith(".jar") ||
file.getName().endsWith(".war") || file.getName().endsWith(".rar") ||
file.getName().endsWith(".ear")) {
+ if ((file.getName().endsWith(".jar") ||
file.getName().endsWith(".war") || file.getName().endsWith(".rar") ||
file.getName().endsWith(".ear")) && !unpackExists(file)) {
jarList.add(url);
hasNestedArchives = true;
} else if (new File(file, "META-INF").exists()) { //
Unpacked ear or jar
@@ -172,6 +172,12 @@ public class DeploymentsResolver impleme
}
}
+ private static boolean unpackExists(final File file) {
+ final String name = file.getName();
+ return !(!name.endsWith("ar") || name.length() < 5)
+ && new File(file.getParentFile(), name.substring(0,
name.length() -".war".length())).exists();
+ }
+
/**
* The algorithm of OpenEJB deployments class-path inclusion and exclusion
is implemented as follows:
* 1- If the string value of the resource URL matches the include
class-path pattern