You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by st...@apache.org on 2018/06/21 10:59:15 UTC

tomee git commit: TOMEE-2197 handle ambiguous Deployment section

Repository: tomee
Updated Branches:
  refs/heads/master 0381cbe07 -> 8547f730b


TOMEE-2197 handle ambiguous Deployment section


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

Branch: refs/heads/master
Commit: 8547f730b7c9fc085534a8f5d1f68340154d2cfe
Parents: 0381cbe
Author: Mark Struberg <st...@apache.org>
Authored: Thu Jun 21 12:41:34 2018 +0200
Committer: Mark Struberg <st...@apache.org>
Committed: Thu Jun 21 12:41:34 2018 +0200

----------------------------------------------------------------------
 .../apache/openejb/config/sys/SaxOpenejb.java    | 19 ++++++++++++++++---
 .../apache/openejb/config/Messages.properties    |  3 +++
 2 files changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/8547f730/container/openejb-core/src/main/java/org/apache/openejb/config/sys/SaxOpenejb.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/sys/SaxOpenejb.java b/container/openejb-core/src/main/java/org/apache/openejb/config/sys/SaxOpenejb.java
index 88944f4..d57ff89 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/config/sys/SaxOpenejb.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/config/sys/SaxOpenejb.java
@@ -19,6 +19,8 @@ package org.apache.openejb.config.sys;
 
 import org.apache.openejb.config.SystemProperty;
 import org.apache.openejb.loader.SystemInstance;
+import org.apache.openejb.util.LogCategory;
+import org.apache.openejb.util.Logger;
 import org.apache.openejb.util.Saxs;
 import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
@@ -45,6 +47,8 @@ import java.util.List;
  */
 class SaxOpenejb extends StackHandler {
 
+    public static Logger logger = Logger.getInstance(LogCategory.OPENEJB, "org.apache.openejb.config");
+
     public static final String HOME_VAR = "$home";
     private final Openejb openejb = new Openejb();
 
@@ -135,9 +139,18 @@ class SaxOpenejb extends StackHandler {
         @Override
         public void startElement(final String uri, final String localName, final String qName, final Attributes attributes) throws SAXException {
             deployments.setDir(attributes.getValue("dir"));
-            deployments.setFile(attributes.getValue("jar"));
-            deployments.setFile(attributes.getValue("file"));
-            deployments.setAutoDeploy("true".equals(attributes.getValue("autoDeploy")));
+
+            String jar = attributes.getValue("jar");
+            String file = attributes.getValue("file");
+
+            if (jar != null && jar.length() > 0 && file != null && file.length() > 0) {
+                logger.warning("configureApplication.ambiguousDeploymentJarFile", file);
+            }
+            deployments.setFile(jar);
+            if (file != null && file.length() > 0) {
+                deployments.setFile(file);
+            }
+            deployments.setAutoDeploy("true".equalsIgnoreCase(attributes.getValue("autoDeploy")));
             checkAttributes(attributes, "dir", "jar", "file", "autoDeploy");
         }
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/8547f730/container/openejb-core/src/main/resources/org/apache/openejb/config/Messages.properties
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/resources/org/apache/openejb/config/Messages.properties b/container/openejb-core/src/main/resources/org/apache/openejb/config/Messages.properties
index a833d79..7f45f1b 100644
--- a/container/openejb-core/src/main/resources/org/apache/openejb/config/Messages.properties
+++ b/container/openejb-core/src/main/resources/org/apache/openejb/config/Messages.properties
@@ -141,6 +141,9 @@ config.configApp=Configuring enterprise application: {0}
 # warning("configureApplication.loadFailed", jarFile.getAbsolutePath(), e.getMessage());
 configureApplication.loadFailed=Jar not loaded. {0}.  {1}
 
+# used in org.apache.openejb.config.sys.SaxOpenejb.DeploymentsElement.startElement if <Deployment> section is ambiguous
+configureApplication.ambiguousDeploymentJarFile = Both 'jar' and 'file' attributes are set in <Deployment>, only file will be used ({0})
+
 # format("configureService.noDefaultService", infoType.getName())
 configureService.noDefaultService = No Default Service for {0}