git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1554813 13f79535-47bb-0310-9956-ffa450edef68master
@@ -3,6 +3,7 @@ Amongst other, the following people contributed to ant: | |||||
Adam Blinkinsop | Adam Blinkinsop | ||||
Adam Bryzak | Adam Bryzak | ||||
Adam Sotona | Adam Sotona | ||||
Adrian Nistor | |||||
Aleksandr Ishutin | Aleksandr Ishutin | ||||
Alex Rosen | Alex Rosen | ||||
Alexei Yudichev | Alexei Yudichev | ||||
@@ -42,6 +42,10 @@ | |||||
<first>Adam</first> | <first>Adam</first> | ||||
<last>Sotona</last> | <last>Sotona</last> | ||||
</name> | </name> | ||||
<name> | |||||
<first>Adrian</first> | |||||
<last>Nistor</last> | |||||
</name> | |||||
<name> | <name> | ||||
<first>Aleksandr</first> | <first>Aleksandr</first> | ||||
<last>Ishutin</last> | <last>Ishutin</last> | ||||
@@ -1017,7 +1017,7 @@ public class ComponentHelper { | |||||
* Print unknown definition.forking | * Print unknown definition.forking | ||||
*/ | */ | ||||
private void printUnknownDefinition(PrintWriter out, String componentName, String dirListing) { | private void printUnknownDefinition(PrintWriter out, String componentName, String dirListing) { | ||||
boolean isAntlib = componentName.indexOf(MagicNames.ANTLIB_PREFIX) == 0; | |||||
boolean isAntlib = componentName.startsWith(MagicNames.ANTLIB_PREFIX); | |||||
String uri = ProjectHelper.extractUriFromComponentName(componentName); | String uri = ProjectHelper.extractUriFromComponentName(componentName); | ||||
out.println("Cause: The name is undefined."); | out.println("Cause: The name is undefined."); | ||||
out.println("Action: Check the spelling."); | out.println("Action: Check the spelling."); | ||||
@@ -156,7 +156,7 @@ public class FailureRecorder extends ProjectComponent implements JUnitResultForm | |||||
Object listener = allListeners.get(i); | Object listener = allListeners.get(i); | ||||
if (listener instanceof FailureRecorder) { | if (listener instanceof FailureRecorder) { | ||||
alreadyRegistered = true; | alreadyRegistered = true; | ||||
continue; | |||||
break; | |||||
} | } | ||||
} | } | ||||
// register if needed | // register if needed | ||||
@@ -727,6 +727,7 @@ public class FTP extends Task implements FTPTaskConfig { | |||||
&& pcounter != icounter | && pcounter != icounter | ||||
&& target.equals(array[pcounter].getName())) { | && target.equals(array[pcounter].getName())) { | ||||
candidateFound = false; | candidateFound = false; | ||||
break; | |||||
} | } | ||||
} | } | ||||
if (candidateFound) { | if (candidateFound) { | ||||
@@ -908,7 +909,7 @@ public class FTP extends Task implements FTPTaskConfig { | |||||
*/ | */ | ||||
public String getFastRelativePath() { | public String getFastRelativePath() { | ||||
String absPath = getAbsolutePath(); | String absPath = getAbsolutePath(); | ||||
if (absPath.indexOf(rootPath + remoteFileSep) == 0) { | |||||
if (absPath.startsWith(rootPath + remoteFileSep)) { | |||||
return absPath.substring(rootPath.length() + remoteFileSep.length()); | return absPath.substring(rootPath.length() + remoteFileSep.length()); | ||||
} | } | ||||
return null; | return null; | ||||
@@ -2356,13 +2357,13 @@ public class FTP extends Task implements FTPTaskConfig { | |||||
throws IOException, BuildException { | throws IOException, BuildException { | ||||
String workingDirectory = ftp.printWorkingDirectory(); | String workingDirectory = ftp.printWorkingDirectory(); | ||||
if (verbose) { | if (verbose) { | ||||
if (dir.indexOf("/") == 0 || workingDirectory == null) { | |||||
if (dir.startsWith("/") || workingDirectory == null) { | |||||
log("Creating directory: " + dir + " in /"); | log("Creating directory: " + dir + " in /"); | ||||
} else { | } else { | ||||
log("Creating directory: " + dir + " in " + workingDirectory); | log("Creating directory: " + dir + " in " + workingDirectory); | ||||
} | } | ||||
} | } | ||||
if (dir.indexOf("/") == 0) { | |||||
if (dir.startsWith("/")) { | |||||
ftp.changeWorkingDirectory("/"); | ftp.changeWorkingDirectory("/"); | ||||
} | } | ||||
String subdir = ""; | String subdir = ""; | ||||
@@ -628,6 +628,7 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror { | |||||
&& pcounter != icounter | && pcounter != icounter | ||||
&& target.equals(array[pcounter].getName())) { | && target.equals(array[pcounter].getName())) { | ||||
candidateFound = false; | candidateFound = false; | ||||
break; | |||||
} | } | ||||
} | } | ||||
if (candidateFound) { | if (candidateFound) { | ||||
@@ -810,7 +811,7 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror { | |||||
*/ | */ | ||||
public String getFastRelativePath() { | public String getFastRelativePath() { | ||||
String absPath = getAbsolutePath(); | String absPath = getAbsolutePath(); | ||||
if (absPath.indexOf(rootPath + task.getSeparator()) == 0) { | |||||
if (absPath.startsWith(rootPath + task.getSeparator())) { | |||||
return absPath.substring(rootPath.length() | return absPath.substring(rootPath.length() | ||||
+ task.getSeparator().length()); | + task.getSeparator().length()); | ||||
} | } | ||||
@@ -1757,13 +1758,13 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror { | |||||
throws IOException, BuildException { | throws IOException, BuildException { | ||||
String workingDirectory = ftp.printWorkingDirectory(); | String workingDirectory = ftp.printWorkingDirectory(); | ||||
if (task.isVerbose()) { | if (task.isVerbose()) { | ||||
if (dir.indexOf("/") == 0 || workingDirectory == null) { | |||||
if (dir.startsWith("/") || workingDirectory == null) { | |||||
task.log("Creating directory: " + dir + " in /"); | task.log("Creating directory: " + dir + " in /"); | ||||
} else { | } else { | ||||
task.log("Creating directory: " + dir + " in " + workingDirectory); | task.log("Creating directory: " + dir + " in " + workingDirectory); | ||||
} | } | ||||
} | } | ||||
if (dir.indexOf("/") == 0) { | |||||
if (dir.startsWith("/")) { | |||||
ftp.changeWorkingDirectory("/"); | ftp.changeWorkingDirectory("/"); | ||||
} | } | ||||
String subdir = ""; | String subdir = ""; | ||||
@@ -637,7 +637,7 @@ public class FileUtils { | |||||
int len = filename.length(); | int len = filename.length(); | ||||
return (c == sep && (len == 1 || filename.charAt(1) != sep)) | return (c == sep && (len == 1 || filename.charAt(1) != sep)) | ||||
|| (Character.isLetter(c) && len > 1 | || (Character.isLetter(c) && len > 1 | ||||
&& filename.indexOf(':') == 1 | |||||
&& filename.charAt(1) == ':' | |||||
&& (len == 2 || filename.charAt(2) != sep)); | && (len == 2 || filename.charAt(2) != sep)); | ||||
} | } | ||||
@@ -17,6 +17,10 @@ | |||||
*/ | */ | ||||
package org.apache.tools.ant.util; | package org.apache.tools.ant.util; | ||||
import java.util.Collection; | |||||
import java.util.HashSet; | |||||
import java.util.IdentityHashMap; | |||||
import java.util.Set; | |||||
import java.util.Stack; | import java.util.Stack; | ||||
/** | /** | ||||
@@ -102,4 +106,18 @@ public class IdentityStack<E> extends Stack<E> { | |||||
return -1; | return -1; | ||||
} | } | ||||
public synchronized boolean removeAll(Collection<?> c) { | |||||
if (!(c instanceof Set)) { | |||||
c = new HashSet(c); | |||||
} | |||||
return super.removeAll(c); | |||||
} | |||||
public synchronized boolean containsAll(Collection<?> c) { | |||||
IdentityHashMap map = new IdentityHashMap(); | |||||
for (Object e : this) { | |||||
map.put(e, Boolean.TRUE); | |||||
} | |||||
return map.keySet().containsAll(c); | |||||
} | |||||
} | } |
@@ -410,7 +410,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
// ${tests.and.ant.share.classloader} will be set | // ${tests.and.ant.share.classloader} will be set | ||||
// we are trying to catch this here. | // we are trying to catch this here. | ||||
if (shareclassloader == null | if (shareclassloader == null | ||||
|| (shareclassloader != null && shareclassloader.indexOf("${") == 0)) { | |||||
|| (shareclassloader != null && shareclassloader.startsWith("${"))) { | |||||
System.out.println("cannot execute testIsExcludedDirectoryScanned when tests are forked, " + | System.out.println("cannot execute testIsExcludedDirectoryScanned when tests are forked, " + | ||||
"package private method called"); | "package private method called"); | ||||
return; | return; | ||||
@@ -204,7 +204,7 @@ public class XmlPropertyTest extends BuildFileTest { | |||||
String xmlValue = (String)xmlproperties.get(currentKey); | String xmlValue = (String)xmlproperties.get(currentKey); | ||||
if ( propertyValue.indexOf("ID.") == 0 ) { | |||||
if (propertyValue.startsWith("ID.")) { | |||||
// The property is an id's thing -- either a property | // The property is an id's thing -- either a property | ||||
// or a path. We need to make sure | // or a path. We need to make sure | ||||
// that the object was created with the given id. | // that the object was created with the given id. | ||||
@@ -231,7 +231,7 @@ public class XmlPropertyTest extends BuildFileTest { | |||||
} else { | } else { | ||||
if (propertyValue.indexOf("FILE.") == 0) { | |||||
if (propertyValue.startsWith("FILE.")) { | |||||
// The property is the name of a file. We are testing | // The property is the name of a file. We are testing | ||||
// a location attribute, so we need to resolve the given | // a location attribute, so we need to resolve the given | ||||
// file name in the provided folder. | // file name in the provided folder. | ||||