tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgallim...@apache.org
Subject [1/2] tomee git commit: TOMEE-2145 fix double deploy issue when deploying an EAR from the webapps directory
Date Wed, 01 Nov 2017 17:27:49 GMT
Repository: tomee
Updated Branches:
  refs/heads/tomee-1.7.x bfdd20c77 -> 4b11c31b7


TOMEE-2145 fix double deploy issue when deploying an EAR from the webapps directory


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

Branch: refs/heads/tomee-1.7.x
Commit: a3150bb3bc53b3dba31598ef3d71fe5b558c6412
Parents: bfdd20c
Author: Jonathan Gallimore <jon@jrg.me.uk>
Authored: Wed Nov 1 17:09:07 2017 +0000
Committer: Jonathan Gallimore <jon@jrg.me.uk>
Committed: Wed Nov 1 17:16:46 2017 +0000

----------------------------------------------------------------------
 .../tomee/catalina/TomcatWebAppBuilder.java     | 25 ++++++++++++++++++++
 1 file changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/a3150bb3/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
index 9a05ce3..0ba0c30 100644
--- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
+++ b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
@@ -1130,6 +1130,10 @@ public class TomcatWebAppBuilder implements WebAppBuilder, ContextListener,
Pare
             return;
         }
 
+        if (shouldNotDeploy(standardContext)) {
+            return;
+        }
+
         final CoreContainerSystem cs = getContainerSystem();
 
         final Assembler a = getAssembler();
@@ -1422,6 +1426,23 @@ public class TomcatWebAppBuilder implements WebAppBuilder, ContextListener,
Pare
         realms.put(standardContext.getName(), realm);
     }
 
+    private static boolean shouldNotDeploy(StandardContext standardContext) {
+        if (StandardHost.class.isInstance(standardContext.getParent())) {
+            final StandardHost host = StandardHost.class.cast(standardContext.getParent());
+            if (host.getAutoDeploy() && new File(host.getAppBaseFile(), standardContext.getPath()).isDirectory()
&& (
+                    new File(host.getAppBaseFile(), standardContext.getPath() + ".ear").exists()
||
+                    new File(host.getAppBaseFile(), standardContext.getPath() + ".rar").exists())
+            ) {
+
+                logger.info(String.format("Not deploying exploded directory %s as Java EE
artifact exists which will be deployed.",
+                        new File(host.getAppBaseFile(), standardContext.getPath()).getAbsolutePath()));
+
+                return true;
+            }
+        }
+        return false;
+    }
+
     private static File rootPath(final File file) {
         if (file.isDirectory() && file.getName().equals("classes") && file.getParentFile()
!= null && file.getParentFile().getName().equals("WEB-INF")) {
             return file.getParentFile().getParentFile();
@@ -1572,6 +1593,10 @@ public class TomcatWebAppBuilder implements WebAppBuilder, ContextListener,
Pare
             return;
         }
 
+        if (shouldNotDeploy(standardContext)) {
+            return;
+        }
+
         final Realm realm = standardContext.getRealm();
         final ClassLoader classLoader = standardContext.getLoader().getClassLoader();
         final Thread thread = Thread.currentThread();


Mime
View raw message