Repository: ant
Updated Branches:
  refs/heads/master 7a477febf -> 588ce1fbe


avoid slash translations for module names

should fix Windows test errors introduced with #15


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

Branch: refs/heads/master
Commit: 588ce1fbe3c07994b03283ddeb82662bb23a2785
Parents: 7a477fe
Author: Stefan Bodewig <[email protected]>
Authored: Sun Mar 6 15:29:27 2016 +0100
Committer: Stefan Bodewig <[email protected]>
Committed: Sun Mar 6 15:29:27 2016 +0100

----------------------------------------------------------------------
 .../org/apache/tools/ant/types/Commandline.java   | 18 ++++++++++++++++--
 .../apache/tools/ant/types/CommandlineJava.java   | 12 +++++++-----
 2 files changed, 23 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/588ce1fb/src/main/org/apache/tools/ant/types/Commandline.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/Commandline.java 
b/src/main/org/apache/tools/ant/types/Commandline.java
index c273d7a..a417a0c 100644
--- a/src/main/org/apache/tools/ant/types/Commandline.java
+++ b/src/main/org/apache/tools/ant/types/Commandline.java
@@ -318,11 +318,25 @@ public class Commandline implements Cloneable {
      * @param executable the String executable name.
      */
     public void setExecutable(String executable) {
+        setExecutable(executable, true);
+    }
+
+    /**
+     * Set the executable to run.
+     *
+     * @param executable the String executable name.
+     * @param translateFileSeparator if {@code true} all file separators in 
the string
+     * are converted to the platform specific value.
+     *
+     * @since Ant 1.9.7
+     */
+    public void setExecutable(String executable, boolean 
translateFileSeparator) {
         if (executable == null || executable.length() == 0) {
             return;
         }
-        this.executable = executable.replace('/', File.separatorChar)
-            .replace('\\', File.separatorChar);
+        this.executable = translateFileSeparator
+            ? executable.replace('/', File.separatorChar).replace('\\', 
File.separatorChar)
+            : executable;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant/blob/588ce1fb/src/main/org/apache/tools/ant/types/CommandlineJava.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/CommandlineJava.java 
b/src/main/org/apache/tools/ant/types/CommandlineJava.java
index c7cc119..5bf91c7 100644
--- a/src/main/org/apache/tools/ant/types/CommandlineJava.java
+++ b/src/main/org/apache/tools/ant/types/CommandlineJava.java
@@ -347,7 +347,7 @@ public class CommandlineJava implements Cloneable {
         if (executableType == ExecutableType.MODULE) {
             javaCommand.setExecutable(createModuleClassPair(
                     
parseModuleFromModuleClassPair(javaCommand.getExecutable()),
-                    classname));
+                    classname), false);
         } else {
             javaCommand.setExecutable(classname);
             executableType = ExecutableType.CLASS;
@@ -382,17 +382,18 @@ public class CommandlineJava implements Cloneable {
         } else {
             switch (executableType) {
                 case JAR:
-                    javaCommand.setExecutable(module);
+                    javaCommand.setExecutable(module, false);
                     break;
                 case CLASS:
                     javaCommand.setExecutable(createModuleClassPair(
                             module,
-                            javaCommand.getExecutable()));
+                            javaCommand.getExecutable()), false);
                     break;
                 case MODULE:
                     javaCommand.setExecutable(createModuleClassPair(
                             module,
-                            
parseClassFromModuleClassPair(javaCommand.getExecutable())));
+                            
parseClassFromModuleClassPair(javaCommand.getExecutable())),
+                                              false);
                     break;
             }
         }
@@ -543,7 +544,8 @@ public class CommandlineJava implements Cloneable {
             listIterator.add("-m");
         }
         // this is the classname to run as well as its arguments.
-        // in case of 'executeJar', the executable is a jar file.
+        // in case of ExecutableType.JAR, the executable is a jar file,
+        // in case of ExecutableType.MODULE, the executable is a module name, 
portentially including a class name.
         javaCommand.addCommandToList(listIterator);
     }
 

Reply via email to