groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject groovy git commit: GROOVY-8295: Groovyc ant task can overflow Windows command line if classpath is large (properly handle multi-part path)
Date Thu, 07 Dec 2017 01:24:03 GMT
Repository: groovy
Updated Branches:
  refs/heads/master 65213a967 -> 4e2303a72


GROOVY-8295: Groovyc ant task can overflow Windows command line if classpath is large (properly
handle multi-part path)


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

Branch: refs/heads/master
Commit: 4e2303a72b5b1429f73060aed8dbf6df4de4b626
Parents: 65213a9
Author: paulk <paulk@asert.com.au>
Authored: Thu Dec 7 11:23:39 2017 +1000
Committer: paulk <paulk@asert.com.au>
Committed: Thu Dec 7 11:23:57 2017 +1000

----------------------------------------------------------------------
 .../main/java/org/codehaus/groovy/ant/Groovyc.java   | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/4e2303a7/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
index 4f0751c..c2e0641 100644
--- a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
+++ b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
@@ -1059,12 +1059,19 @@ public class Groovyc extends MatchingTask {
     }
 
     private String getClasspathRelative(Path classpath) {
-        String raw = classpath.toString();
         String baseDir = getProject().getBaseDir().getAbsolutePath();
-        if (!raw.startsWith(baseDir)) {
-            return raw;
+        StringBuilder sb = new StringBuilder();
+        for (String next : classpath.list()) {
+            if (sb.length() > 0) {
+                sb.append(File.pathSeparatorChar);
+            }
+            if (next.startsWith(baseDir)) {
+                sb.append(".").append(next.substring(baseDir.length()));
+            } else {
+                sb.append(next);
+            }
         }
-        return "." + raw.substring(baseDir.length());
+        return sb.toString();
     }
 
     /**


Mime
View raw message