@@ -19,12 +19,9 @@ | |||||
package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
import java.io.File; | import java.io.File; | ||||
import java.io.FileWriter; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.OutputStream; | |||||
import java.io.OutputStreamWriter; | import java.io.OutputStreamWriter; | ||||
import java.io.PrintWriter; | import java.io.PrintWriter; | ||||
import java.io.UnsupportedEncodingException; | |||||
import java.nio.charset.StandardCharsets; | import java.nio.charset.StandardCharsets; | ||||
import java.nio.file.Files; | import java.nio.file.Files; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
@@ -43,7 +40,6 @@ import org.apache.tools.ant.Task; | |||||
import org.apache.tools.ant.TaskContainer; | import org.apache.tools.ant.TaskContainer; | ||||
import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
import org.apache.tools.ant.types.Reference; | import org.apache.tools.ant.types.Reference; | ||||
import org.apache.tools.ant.util.FileUtils; | |||||
/** | /** | ||||
* Creates a partial DTD for Ant from the currently known tasks. | * Creates a partial DTD for Ant from the currently known tasks. | ||||
@@ -111,18 +111,7 @@ public class JUnit4TestMethodAdapter implements Test { | |||||
@Override | @Override | ||||
public String toString() { | public String toString() { | ||||
String testClassName = testClass.getName(); | |||||
StringBuilder buf = new StringBuilder(testClassName.length() | |||||
+ 12 * methodNames.length) | |||||
.append(':'); | |||||
if (methodNames.length != 0) { | |||||
buf.append(methodNames[0]); | |||||
for (int i = 1; i < methodNames.length; i++) { | |||||
buf.append(',') | |||||
.append(methodNames[i]); | |||||
} | |||||
} | |||||
return buf.toString(); | |||||
return ":" + String.join(",", methodNames); | |||||
} | } | ||||
private static final class MultipleMethodsFilter extends Filter { | private static final class MultipleMethodsFilter extends Filter { | ||||
@@ -166,10 +155,7 @@ public class JUnit4TestMethodAdapter implements Test { | |||||
buf.append("No methods"); | buf.append("No methods"); | ||||
} else { | } else { | ||||
buf.append(methodNames.length == 1 ? "Method " : "Methods "); | buf.append(methodNames.length == 1 ? "Method " : "Methods "); | ||||
for (String methodName : methodNames) { | |||||
buf.append(methodName).append(','); | |||||
} | |||||
buf.setLength(buf.length() - 1); | |||||
buf.append(String.join(",", methodNames)); | |||||
} | } | ||||
buf.append('(').append(testClass.getName()).append(')'); | buf.append('(').append(testClass.getName()).append(')'); | ||||
return buf.toString(); | return buf.toString(); | ||||
@@ -222,18 +222,7 @@ public class JUnitTest extends BaseTest implements Cloneable { | |||||
*/ | */ | ||||
String getMethodsString() { | String getMethodsString() { | ||||
if (methodsList == null && methodsSpecified) { | if (methodsList == null && methodsSpecified) { | ||||
if (methods.length == 0) { | |||||
methodsList = ""; | |||||
} else if (methods.length == 1) { | |||||
methodsList = methods[0]; | |||||
} else { | |||||
StringBuilder buf = new StringBuilder(methods.length * 16); | |||||
buf.append(methods[0]); | |||||
for (int i = 1; i < methods.length; i++) { | |||||
buf.append(',').append(methods[i]); | |||||
} | |||||
methodsList = buf.toString(); | |||||
} | |||||
methodsList = methods.length == 0 ? "" : String.join(",", methods); | |||||
} | } | ||||
return methodsList; | return methodsList; | ||||
} | } | ||||
@@ -244,11 +244,7 @@ public class FTP extends Task implements FTPTaskConfig { | |||||
*/ | */ | ||||
@Override | @Override | ||||
public String getParent() { | public String getParent() { | ||||
StringBuilder result = new StringBuilder(); | |||||
for (int i = 0; i < parts.length - 1; i++) { | |||||
result.append(File.separatorChar).append(parts[i]); | |||||
} | |||||
return result.toString(); | |||||
return File.separator + String.join(File.separator, parts); | |||||
} | } | ||||
@@ -20,7 +20,6 @@ package org.apache.tools.ant.types; | |||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import org.apache.tools.ant.DirectoryScanner; | |||||
import org.apache.tools.ant.types.resources.FileResourceIterator; | import org.apache.tools.ant.types.resources.FileResourceIterator; | ||||
/** | /** | ||||