git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270906 13f79535-47bb-0310-9956-ffa450edef68master
@@ -262,7 +262,7 @@ public class AntClassLoader extends ClassLoader implements BuildListener { | |||||
String[] pathElements = actualClasspath.list(); | String[] pathElements = actualClasspath.list(); | ||||
for (int i = 0; i < pathElements.length; ++i) { | for (int i = 0; i < pathElements.length; ++i) { | ||||
try { | try { | ||||
addPathElement((String)pathElements[i]); | |||||
addPathElement(pathElements[i]); | |||||
} | } | ||||
catch (BuildException e) { | catch (BuildException e) { | ||||
// ignore path elements which are invalid relative to the project | // ignore path elements which are invalid relative to the project | ||||
@@ -1,7 +1,7 @@ | |||||
/* | /* | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* | * | ||||
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights | |||||
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights | |||||
* reserved. | * reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
@@ -146,7 +146,8 @@ public class Ant extends Task { | |||||
private void reinit() { | private void reinit() { | ||||
init(); | init(); | ||||
for (int i=0; i<properties.size(); i++) { | |||||
final int count = properties.size(); | |||||
for (int i = 0; i < count; i++) { | |||||
Property p = (Property) properties.elementAt(i); | Property p = (Property) properties.elementAt(i); | ||||
Property newP = (Property) newProject.createTask("property"); | Property newP = (Property) newProject.createTask("property"); | ||||
newP.setName(p.getName()); | newP.setName(p.getName()); | ||||
@@ -165,7 +166,8 @@ public class Ant extends Task { | |||||
private void initializeProject() { | private void initializeProject() { | ||||
Vector listeners = project.getBuildListeners(); | Vector listeners = project.getBuildListeners(); | ||||
for (int i = 0; i < listeners.size(); i++) { | |||||
final int count = properties.size(); | |||||
for (int i = 0; i < count; i++) { | |||||
newProject.addBuildListener((BuildListener)listeners.elementAt(i)); | newProject.addBuildListener((BuildListener)listeners.elementAt(i)); | ||||
} | } | ||||
@@ -205,10 +207,9 @@ public class Ant extends Task { | |||||
// set user-defined or all properties from calling project | // set user-defined or all properties from calling project | ||||
Hashtable prop1; | Hashtable prop1; | ||||
if (inheritAll == true) { | |||||
if (inheritAll) { | |||||
prop1 = project.getProperties(); | prop1 = project.getProperties(); | ||||
} | |||||
else { | |||||
} else { | |||||
prop1 = project.getUserProperties(); | prop1 = project.getUserProperties(); | ||||
// set Java built-in properties separately, | // set Java built-in properties separately, | ||||
@@ -225,7 +226,7 @@ public class Ant extends Task { | |||||
} | } | ||||
String value = (String) prop1.get(arg); | String value = (String) prop1.get(arg); | ||||
if (inheritAll == true){ | |||||
if (inheritAll){ | |||||
newProject.setProperty(arg, value); | newProject.setProperty(arg, value); | ||||
} else { | } else { | ||||
newProject.setUserProperty(arg, value); | newProject.setUserProperty(arg, value); | ||||
@@ -236,8 +237,7 @@ public class Ant extends Task { | |||||
protected void handleOutput(String line) { | protected void handleOutput(String line) { | ||||
if (newProject != null) { | if (newProject != null) { | ||||
newProject.demuxOutput(line, false); | newProject.demuxOutput(line, false); | ||||
} | |||||
else { | |||||
} else { | |||||
super.handleOutput(line); | super.handleOutput(line); | ||||
} | } | ||||
} | } | ||||
@@ -245,8 +245,7 @@ public class Ant extends Task { | |||||
protected void handleErrorOutput(String line) { | protected void handleErrorOutput(String line) { | ||||
if (newProject != null) { | if (newProject != null) { | ||||
newProject.demuxOutput(line, true); | newProject.demuxOutput(line, true); | ||||
} | |||||
else { | |||||
} else { | |||||
super.handleErrorOutput(line); | super.handleErrorOutput(line); | ||||
} | } | ||||
} | } | ||||
@@ -260,7 +259,7 @@ public class Ant extends Task { | |||||
reinit(); | reinit(); | ||||
} | } | ||||
if ( (dir == null) && (inheritAll == true) ) { | |||||
if ( (dir == null) && (inheritAll) ) { | |||||
dir = project.getBaseDir(); | dir = project.getBaseDir(); | ||||
} | } | ||||
@@ -344,7 +343,7 @@ public class Ant extends Task { | |||||
continue; | continue; | ||||
} | } | ||||
Object o = thisReferences.remove(refid); | |||||
thisReferences.remove(refid); | |||||
String toRefid = ref.getToRefid(); | String toRefid = ref.getToRefid(); | ||||
if (toRefid == null) { | if (toRefid == null) { | ||||
toRefid = refid; | toRefid = refid; | ||||
@@ -1,7 +1,7 @@ | |||||
/* | /* | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* | * | ||||
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights | |||||
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights | |||||
* reserved. | * reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
@@ -253,21 +253,22 @@ public class AntStructure extends Task { | |||||
Enumeration enum = ih.getNestedElements(); | Enumeration enum = ih.getNestedElements(); | ||||
while (enum.hasMoreElements()) { | while (enum.hasMoreElements()) { | ||||
v.addElement((String) enum.nextElement()); | |||||
v.addElement(enum.nextElement()); | |||||
} | } | ||||
if (v.isEmpty()) { | if (v.isEmpty()) { | ||||
sb.append("EMPTY"); | sb.append("EMPTY"); | ||||
} else { | } else { | ||||
sb.append("("); | sb.append("("); | ||||
for (int i=0; i<v.size(); i++) { | |||||
final int count = v.size(); | |||||
for (int i = 0; i < count; i++) { | |||||
if (i != 0) { | if (i != 0) { | ||||
sb.append(" | "); | sb.append(" | "); | ||||
} | } | ||||
sb.append(v.elementAt(i)); | sb.append(v.elementAt(i)); | ||||
} | } | ||||
sb.append(")"); | sb.append(")"); | ||||
if (v.size() > 1 || !v.elementAt(0).equals("#PCDATA")) { | |||||
if (count > 1 || !v.elementAt(0).equals("#PCDATA")) { | |||||
sb.append("*"); | sb.append("*"); | ||||
} | } | ||||
} | } | ||||
@@ -324,7 +325,8 @@ public class AntStructure extends Task { | |||||
sb.append(">").append(lSep); | sb.append(">").append(lSep); | ||||
out.println(sb); | out.println(sb); | ||||
for (int i=0; i<v.size(); i++) { | |||||
final int count = v.size(); | |||||
for (int i = 0; i < count; i++) { | |||||
String nestedName = (String) v.elementAt(i); | String nestedName = (String) v.elementAt(i); | ||||
if (!"#PCDATA".equals(nestedName) && | if (!"#PCDATA".equals(nestedName) && | ||||
!TASKS.equals(nestedName) && | !TASKS.equals(nestedName) && | ||||
@@ -341,7 +343,8 @@ public class AntStructure extends Task { | |||||
* Does this String match the XML-NMTOKEN production? | * Does this String match the XML-NMTOKEN production? | ||||
*/ | */ | ||||
protected boolean isNmtoken(String s) { | protected boolean isNmtoken(String s) { | ||||
for (int i = 0; i < s.length(); i++) { | |||||
final int length = s.length(); | |||||
for (int i = 0; i < length; i++) { | |||||
char c = s.charAt(i); | char c = s.charAt(i); | ||||
// XXX - we are ommitting CombiningChar and Extender here | // XXX - we are ommitting CombiningChar and Extender here | ||||
if (!Character.isLetterOrDigit(c) && | if (!Character.isLetterOrDigit(c) && | ||||
@@ -360,13 +360,13 @@ public class Checksum extends MatchingTask implements Condition { | |||||
fis.close(); | fis.close(); | ||||
fis = null; | fis = null; | ||||
byte[] fileDigest = messageDigest.digest (); | byte[] fileDigest = messageDigest.digest (); | ||||
String checksum = ""; | |||||
StringBuffer checksum = new StringBuffer(); | |||||
for (int i = 0; i < fileDigest.length; i++) { | for (int i = 0; i < fileDigest.length; i++) { | ||||
String hexStr = Integer.toHexString(0x00ff & fileDigest[i]); | String hexStr = Integer.toHexString(0x00ff & fileDigest[i]); | ||||
if (hexStr.length() < 2) { | if (hexStr.length() < 2) { | ||||
checksum += "0"; | |||||
checksum.append("0"); | |||||
} | } | ||||
checksum += hexStr; | |||||
checksum.append(hexStr); | |||||
} | } | ||||
//can either be a property name string or a file | //can either be a property name string or a file | ||||
Object destination = includeFileMap.get(src); | Object destination = includeFileMap.get(src); | ||||
@@ -375,7 +375,7 @@ public class Checksum extends MatchingTask implements Condition { | |||||
if (isCondition) { | if (isCondition) { | ||||
checksumMatches = checksum.equals(property); | checksumMatches = checksum.equals(property); | ||||
} else { | } else { | ||||
project.setProperty(prop, checksum); | |||||
project.setProperty(prop, checksum.toString()); | |||||
} | } | ||||
} else if (destination instanceof java.io.File) { | } else if (destination instanceof java.io.File) { | ||||
if (isCondition) { | if (isCondition) { | ||||
@@ -398,7 +398,7 @@ public class Checksum extends MatchingTask implements Condition { | |||||
} else { | } else { | ||||
File dest = (File) destination; | File dest = (File) destination; | ||||
fos = new FileOutputStream(dest); | fos = new FileOutputStream(dest); | ||||
fos.write(checksum.getBytes()); | |||||
fos.write(checksum.toString().getBytes()); | |||||
fos.close(); | fos.close(); | ||||
fos = null; | fos = null; | ||||
} | } | ||||