You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2012/07/01 20:28:23 UTC

svn commit: r1355974 - /ofbiz/branches/release11.04/framework/appserver/src/org/ofbiz/appservers/GenerateContainer.java

Author: jleroux
Date: Sun Jul  1 18:28:22 2012
New Revision: 1355974

URL: http://svn.apache.org/viewvc?rev=1355974&view=rev
Log:
A patch from Sankp for "Incorrect argument processing while Generating container" https://issues.apache.org/jira/browse/OFBIZ-4929

The GenerateContainer.java source does not correctly process the arguments supplied in the command "java -jar ofbiz.jar -setup tomcat6" from OFBIZ_HOME. Running this command results in an error condition as given below
"Template location - -setup does not exist!"

jleroux: I was pretty surprised by this fix, for 2 reasons. With the same command:
* The same file used in R10.04 generates the files and ends gracefully
* Almost the same file used in trunk generates the files, but did not ends gracefully. The trunk file was changed recently but those changes are totally unrelated to this.

So I wonder why these changes are solving this issue in R11.04 but are not needed in trunk. Certainly intermediate change/s somewhere else which have been amended since.

Modified:
    ofbiz/branches/release11.04/framework/appserver/src/org/ofbiz/appservers/GenerateContainer.java

Modified: ofbiz/branches/release11.04/framework/appserver/src/org/ofbiz/appservers/GenerateContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/framework/appserver/src/org/ofbiz/appservers/GenerateContainer.java?rev=1355974&r1=1355973&r2=1355974&view=diff
==============================================================================
--- ofbiz/branches/release11.04/framework/appserver/src/org/ofbiz/appservers/GenerateContainer.java (original)
+++ ofbiz/branches/release11.04/framework/appserver/src/org/ofbiz/appservers/GenerateContainer.java Sun Jul  1 18:28:22 2012
@@ -79,7 +79,7 @@ public class GenerateContainer implement
         ofbizHome = System.getProperty("ofbiz.home");
         this.configFile = configFile;
         this.args = args;
-        isGeronimo = args[0].toLowerCase().contains("geronimo") || args[0].toLowerCase().contains("wasce");
+        isGeronimo = args[1].toLowerCase().contains("geronimo") || args[1].toLowerCase().contains("wasce");
         if (isGeronimo) {
             target="/META-INF/";
             geronimoHome = System.getenv("GERONIMO_HOME");
@@ -156,7 +156,7 @@ public class GenerateContainer implement
             for(int inst = 0; inst <= instancesNumber; inst++) {
                 instanceNumber = (inst == 0 ? "" : inst).toString();
                 GenerateGeronimoDeployment geronimoDeployment = new GenerateGeronimoDeployment();
-                List<String> classpathJars = geronimoDeployment.generate(args[0], geronimoHostHome, instanceNumber);
+                List<String> classpathJars = geronimoDeployment.generate(args[1], geronimoHostHome, instanceNumber);
                 if (classpathJars == null) {
                     throw new ContainerException("Error in Geronimo deployment, please check the log");
                 }
@@ -233,7 +233,6 @@ public class GenerateContainer implement
                         parseTemplate(files[i], dataMap);
                     }
                 }
-
                 String ofbizName = "ofbiz" + instanceNumber;
                 String separator = File.separator;
                 File workingDir = new File(geronimoHome + separator + "bin");
@@ -376,7 +375,7 @@ public class GenerateContainer implement
             throw new ContainerException("Invalid application server type argument passed");
         }
 
-        String templateLocation = args[0];
+        String templateLocation = args[1];
         if (templateLocation == null) {
             throw new ContainerException("Unable to locate Application Server template directory");
         }
@@ -426,13 +425,13 @@ public class GenerateContainer implement
 
     private String getTargetDirectory() throws ContainerException {
         // create the target file/directory
-        String targetDirectoryName = args.length > 1 ? args[1] : null;
+        String targetDirectoryName = args.length > 2 ? args[2] : null;
         if (targetDirectoryName == null) {
             targetDirectoryName = target;
         }
         String targetDirectory = null;
         if (!isGeronimo) {
-            targetDirectory = ofbizHome + targetDirectoryName + args[0];
+            targetDirectory = ofbizHome + targetDirectoryName + args[1];
         } else {
             targetDirectory = ofbizHome + targetDirectoryName;
         }
@@ -467,7 +466,6 @@ public class GenerateContainer implement
                 }
             }
         }
-
         // create the target file/directory
         String targetDirectory = getTargetDirectory();