git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277030 13f79535-47bb-0310-9956-ffa450edef68master
@@ -830,9 +830,9 @@ public class Project { | |||
Properties systemP = System.getProperties(); | |||
Enumeration e = systemP.propertyNames(); | |||
while (e.hasMoreElements()) { | |||
String name = (String) e.nextElement(); | |||
String value = systemP.getProperty(name); | |||
this.setPropertyInternal(name.toString(), value); | |||
String propertyName = (String) e.nextElement(); | |||
String value = systemP.getProperty(propertyName); | |||
this.setPropertyInternal(propertyName, value); | |||
} | |||
} | |||
@@ -21,7 +21,6 @@ import java.io.Reader; | |||
import java.util.Vector; | |||
import java.util.Enumeration; | |||
import org.apache.tools.ant.BuildException; | |||
import org.apache.tools.ant.Project; | |||
import org.apache.tools.ant.ProjectComponent; | |||
import org.apache.tools.ant.types.RegularExpression; | |||
import org.apache.tools.ant.types.Substitution; | |||
@@ -645,7 +644,6 @@ public class TokenFilter extends BaseFilterReader | |||
public static class ContainsRegex extends ChainableReaderFilter { | |||
private String from; | |||
private String to; | |||
private Project project; | |||
private RegularExpression regularExpression; | |||
private Substitution substitution; | |||
private boolean initialized = false; | |||
@@ -685,7 +683,7 @@ public class TokenFilter extends BaseFilterReader | |||
} | |||
regularExpression = new RegularExpression(); | |||
regularExpression.setPattern(from); | |||
regexp = regularExpression.getRegexp(project); | |||
regexp = regularExpression.getRegexp(getProject()); | |||
if (to == null) { | |||
return; | |||
} | |||
@@ -138,7 +138,7 @@ public final class ChainReaderHelper { | |||
= (AntFilterReader) finalFilters.elementAt(i); | |||
final String className = filter.getClassName(); | |||
final Path classpath = filter.getClasspath(); | |||
final Project project = filter.getProject(); | |||
final Project pro = filter.getProject(); | |||
if (className != null) { | |||
try { | |||
Class clazz = null; | |||
@@ -146,7 +146,7 @@ public final class ChainReaderHelper { | |||
clazz = Class.forName(className); | |||
} else { | |||
AntClassLoader al | |||
= project.createClassLoader(classpath); | |||
= pro.createClassLoader(classpath); | |||
clazz = Class.forName(className, true, al); | |||
} | |||
if (clazz != null) { | |||
@@ -103,12 +103,12 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
throw new BuildException("Only File source supported by " | |||
+ "default plugin"); | |||
} | |||
File buildFile = (File) source; | |||
File bFile = (File) source; | |||
FileInputStream inputStream = null; | |||
InputSource inputSource = null; | |||
this.project = project; | |||
this.buildFile = new File(buildFile.getAbsolutePath()); | |||
this.buildFile = new File(bFile.getAbsolutePath()); | |||
buildFileParent = new File(this.buildFile.getParent()); | |||
try { | |||
@@ -119,11 +119,11 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
} | |||
String uri = fu.toURI(buildFile.getAbsolutePath()); | |||
inputStream = new FileInputStream(buildFile); | |||
String uri = fu.toURI(bFile.getAbsolutePath()); | |||
inputStream = new FileInputStream(bFile); | |||
inputSource = new InputSource(inputStream); | |||
inputSource.setSystemId(uri); | |||
project.log("parsing buildfile " + buildFile + " with URI = " | |||
project.log("parsing buildfile " + bFile + " with URI = " | |||
+ uri, Project.MSG_VERBOSE); | |||
HandlerBase hb = new RootHandler(this); | |||
parser.setDocumentHandler(hb); | |||
@@ -102,9 +102,9 @@ public class AntStructure extends Task { | |||
Enumeration tasks = getProject().getTaskDefinitions().keys(); | |||
while (tasks.hasMoreElements()) { | |||
String taskName = (String) tasks.nextElement(); | |||
printElementDecl(out, taskName, | |||
(Class) getProject().getTaskDefinitions().get(taskName)); | |||
String tName = (String) tasks.nextElement(); | |||
printElementDecl(out, tName, | |||
(Class) getProject().getTaskDefinitions().get(tName)); | |||
} | |||
} catch (IOException ioe) { | |||
@@ -131,13 +131,13 @@ public class AntStructure extends Task { | |||
out.print("<!ENTITY % tasks \""); | |||
boolean first = true; | |||
while (tasks.hasMoreElements()) { | |||
String taskName = (String) tasks.nextElement(); | |||
String tName = (String) tasks.nextElement(); | |||
if (!first) { | |||
out.print(" | "); | |||
} else { | |||
first = false; | |||
} | |||
out.print(taskName); | |||
out.print(tName); | |||
} | |||
out.println("\">"); | |||
out.print("<!ENTITY % types \""); | |||
@@ -214,12 +214,12 @@ public abstract class Definer extends DefBase { | |||
while (urls.hasMoreElements()) { | |||
URL url = (URL) urls.nextElement(); | |||
int format = this.format; | |||
int fmt = this.format; | |||
if (url.toString().toLowerCase(Locale.US).endsWith(".xml")) { | |||
format = Format.XML; | |||
fmt = Format.XML; | |||
} | |||
if (format == Format.PROPERTIES) { | |||
if (fmt == Format.PROPERTIES) { | |||
loadProperties(al, url); | |||
break; | |||
} else { | |||
@@ -642,13 +642,13 @@ public class Delete extends MatchingTask { | |||
if (dirs.length > 0 && includeEmpty) { | |||
int dirCount = 0; | |||
for (int j = dirs.length - 1; j >= 0; j--) { | |||
File dir = new File(d, dirs[j]); | |||
String[] dirFiles = dir.list(); | |||
File currDir = new File(d, dirs[j]); | |||
String[] dirFiles = currDir.list(); | |||
if (dirFiles == null || dirFiles.length == 0) { | |||
log("Deleting " + dir.getAbsolutePath(), verbosity); | |||
if (!delete(dir)) { | |||
log("Deleting " + currDir.getAbsolutePath(), verbosity); | |||
if (!delete(currDir)) { | |||
String message = "Unable to delete directory " | |||
+ dir.getAbsolutePath(); | |||
+ currDir.getAbsolutePath(); | |||
if (failonerror) { | |||
throw new BuildException(message); | |||
} else { | |||
@@ -416,8 +416,8 @@ public class ExecTask extends Task { | |||
} | |||
if (p == null) { | |||
Vector env = Execute.getProcEnvironment(); | |||
Enumeration e = env.elements(); | |||
Vector envVars = Execute.getProcEnvironment(); | |||
Enumeration e = envVars.elements(); | |||
while (e.hasMoreElements()) { | |||
String line = (String) e.nextElement(); | |||
if (isPath(line)) { | |||
@@ -535,10 +535,10 @@ public class Execute { | |||
} | |||
}; | |||
ExecuteStreamHandler streamHandler = new PumpStreamHandler(dummyOut); | |||
streamHandler.setProcessErrorStream(process.getErrorStream()); | |||
streamHandler.setProcessOutputStream(process.getInputStream()); | |||
streamHandler.start(); | |||
ExecuteStreamHandler handler = new PumpStreamHandler(dummyOut); | |||
handler.setProcessErrorStream(process.getErrorStream()); | |||
handler.setProcessOutputStream(process.getInputStream()); | |||
handler.start(); | |||
process.getOutputStream().close(); | |||
project.log("spawned process " + process.toString(), Project.MSG_VERBOSE); | |||
@@ -17,6 +17,7 @@ | |||
package org.apache.tools.ant.taskdefs; | |||
import org.apache.tools.ant.Project; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.BuildException; | |||
import org.apache.tools.ant.ExitStatusException; | |||
@@ -136,7 +137,7 @@ public class Exit extends Task { | |||
} | |||
} | |||
} | |||
log("failing due to " + text, getProject().MSG_DEBUG); | |||
log("failing due to " + text, Project.MSG_DEBUG); | |||
throw ((status == null) ? new BuildException(text) | |||
: new ExitStatusException(text, status.intValue())); | |||
} | |||
@@ -574,12 +574,12 @@ public class FixCRLF extends MatchingTask { | |||
*/ | |||
private void nextStateChange(OneLiner.BufferLine bufline) | |||
throws BuildException { | |||
int eol = bufline.length(); | |||
int eofl = bufline.length(); | |||
int ptr = bufline.getNext(); | |||
// Look for next single or double quote, double slash or slash star | |||
while (ptr < eol) { | |||
while (ptr < eofl) { | |||
switch (bufline.getChar(ptr++)) { | |||
case '\'': | |||
bufline.setState(IN_CHAR_CONST); | |||
@@ -590,7 +590,7 @@ public class FixCRLF extends MatchingTask { | |||
bufline.setLookahead(--ptr); | |||
return; | |||
case '/': | |||
if (ptr < eol) { | |||
if (ptr < eofl) { | |||
if (bufline.getChar(ptr) == '*') { | |||
bufline.setState(IN_MULTI_COMMENT); | |||
bufline.setLookahead(--ptr); | |||
@@ -604,7 +604,7 @@ public class FixCRLF extends MatchingTask { | |||
break; | |||
} // end of switch (bufline.getChar(ptr++)) | |||
} // end of while (ptr < eol) | |||
} // end of while (ptr < eofl) | |||
// Eol is the next token | |||
bufline.setLookahead(ptr); | |||
} | |||
@@ -626,10 +626,10 @@ public class FixCRLF extends MatchingTask { | |||
private void endOfCharConst(OneLiner.BufferLine bufline, char terminator) | |||
throws BuildException { | |||
int ptr = bufline.getNext(); | |||
int eol = bufline.length(); | |||
int eofl = bufline.length(); | |||
char c; | |||
ptr++; // skip past initial quote | |||
while (ptr < eol) { | |||
while (ptr < eofl) { | |||
if ((c = bufline.getChar(ptr++)) == '\\') { | |||
ptr++; | |||
} else { | |||
@@ -638,7 +638,7 @@ public class FixCRLF extends MatchingTask { | |||
return; | |||
} | |||
} | |||
} // end of while (ptr < eol) | |||
} // end of while (ptr < eofl) | |||
// Must have fallen through to the end of the line | |||
throw new BuildException("endOfCharConst: unterminated char constant"); | |||
} | |||
@@ -80,7 +80,7 @@ public class Javac extends MatchingTask { | |||
private boolean deprecation = false; | |||
private boolean depend = false; | |||
private boolean verbose = false; | |||
private String target; | |||
private String targetAttribute; | |||
private Path bootclasspath; | |||
private Path extdirs; | |||
private boolean includeAntRuntime = true; | |||
@@ -565,7 +565,7 @@ public class Javac extends MatchingTask { | |||
* @param target the target VM | |||
*/ | |||
public void setTarget(String target) { | |||
this.target = target; | |||
this.targetAttribute = target; | |||
} | |||
/** | |||
@@ -573,7 +573,7 @@ public class Javac extends MatchingTask { | |||
* @return the target VM | |||
*/ | |||
public String getTarget() { | |||
return target; | |||
return targetAttribute; | |||
} | |||
/** | |||
@@ -1257,8 +1257,6 @@ public class Javadoc extends Task { | |||
public class TagArgument extends FileSet { | |||
/** Name of the tag. */ | |||
private String name = null; | |||
/** Description of the tag to place in the JavaDocs. */ | |||
private String description = null; | |||
/** Whether or not the tag is enabled. */ | |||
private boolean enabled = true; | |||
/** | |||
@@ -1282,17 +1280,6 @@ public class Javadoc extends Task { | |||
this.name = name; | |||
} | |||
/** | |||
* Sets the description of the tag. This is what appears in | |||
* the JavaDoc. | |||
* | |||
* @param description The description of the tag. | |||
* Must not be <code>null</code> or empty. | |||
*/ | |||
public void setDescription (String description) { | |||
this.description = description; | |||
} | |||
/** | |||
* Sets the scope of the tag. This is in comma-separated | |||
* form, with each element being one of "all" (the default), | |||
@@ -1389,9 +1376,9 @@ public class Javadoc extends Task { | |||
if (name == null || name.equals("")) { | |||
throw new BuildException ("No name specified for custom tag."); | |||
} | |||
if (description != null) { | |||
if (getDescription() != null) { | |||
return name + ":" + (enabled ? "" : "X") | |||
+ scope + ":" + description; | |||
+ scope + ":" + getDescription(); | |||
} else { | |||
return name; | |||
} | |||
@@ -257,8 +257,8 @@ public class MacroInstance extends Task implements DynamicAttribute, TaskContain | |||
RuntimeConfigurable rc = new RuntimeConfigurable( | |||
ret, ue.getTaskName()); | |||
rc.setPolyType(ue.getWrapper().getPolyType()); | |||
Map map = ue.getWrapper().getAttributeMap(); | |||
for (Iterator i = map.entrySet().iterator(); i.hasNext();) { | |||
Map m = ue.getWrapper().getAttributeMap(); | |||
for (Iterator i = m.entrySet().iterator(); i.hasNext();) { | |||
Map.Entry entry = (Map.Entry) i.next(); | |||
rc.setAttribute( | |||
(String) entry.getKey(), | |||
@@ -495,16 +495,16 @@ public class Property extends Task { | |||
resolveAllProperties(props); | |||
Enumeration e = props.keys(); | |||
while (e.hasMoreElements()) { | |||
String name = (String) e.nextElement(); | |||
String value = props.getProperty(name); | |||
String propertyName = (String) e.nextElement(); | |||
String propertyValue = props.getProperty(propertyName); | |||
String v = getProject().replaceProperties(value); | |||
String v = getProject().replaceProperties(propertyValue); | |||
if (prefix != null) { | |||
name = prefix + name; | |||
propertyName = prefix + propertyName; | |||
} | |||
addProperty(name, v); | |||
addProperty(propertyName, v); | |||
} | |||
} | |||
@@ -531,9 +531,9 @@ public class Property extends Task { | |||
*/ | |||
private void resolveAllProperties(Properties props) throws BuildException { | |||
for (Enumeration e = props.keys(); e.hasMoreElements();) { | |||
String name = (String) e.nextElement(); | |||
String propertyName = (String) e.nextElement(); | |||
Stack referencesSeen = new Stack(); | |||
resolve(props, name, referencesSeen); | |||
resolve(props, propertyName, referencesSeen); | |||
} | |||
} | |||
@@ -554,10 +554,11 @@ public class Property extends Task { | |||
+ "defined."); | |||
} | |||
String value = props.getProperty(name); | |||
String propertyValue = props.getProperty(name); | |||
Vector fragments = new Vector(); | |||
Vector propertyRefs = new Vector(); | |||
ProjectHelper.parsePropertyString(value, fragments, propertyRefs); | |||
ProjectHelper.parsePropertyString(propertyValue, fragments, | |||
propertyRefs); | |||
if (propertyRefs.size() != 0) { | |||
referencesSeen.push(name); | |||
@@ -580,8 +581,8 @@ public class Property extends Task { | |||
} | |||
sb.append(fragment); | |||
} | |||
value = sb.toString(); | |||
props.put(name, value); | |||
propertyValue = sb.toString(); | |||
props.put(name, propertyValue); | |||
referencesSeen.pop(); | |||
} | |||
} | |||
@@ -233,10 +233,10 @@ public class Replace extends MatchingTask { | |||
Properties props = getProperties(replaceFilterFile); | |||
Enumeration e = props.keys(); | |||
while (e.hasMoreElements()) { | |||
String token = e.nextElement().toString(); | |||
String tok = e.nextElement().toString(); | |||
Replacefilter replaceFilter = createReplacefilter(); | |||
replaceFilter.setToken(token); | |||
replaceFilter.setValue(props.getProperty(token)); | |||
replaceFilter.setToken(tok); | |||
replaceFilter.setValue(props.getProperty(tok)); | |||
} | |||
} | |||
@@ -326,12 +326,12 @@ public class Replace extends MatchingTask { | |||
* @throws BuildException if the file could not be found or read | |||
*/ | |||
public Properties getProperties(File propertyFile) throws BuildException { | |||
Properties properties = new Properties(); | |||
Properties props = new Properties(); | |||
FileInputStream in = null; | |||
try { | |||
in = new FileInputStream(propertyFile); | |||
properties.load(in); | |||
props.load(in); | |||
} catch (FileNotFoundException e) { | |||
String message = "Property file (" + propertyFile.getPath() | |||
+ ") not found."; | |||
@@ -350,7 +350,7 @@ public class Replace extends MatchingTask { | |||
} | |||
} | |||
return properties; | |||
return props; | |||
} | |||
/** | |||
@@ -382,7 +382,7 @@ public class Replace extends MatchingTask { | |||
BufferedReader br = new BufferedReader(reader); | |||
BufferedWriter bw = new BufferedWriter(writer); | |||
String buf = fileUtils.readFully(br); | |||
String buf = FileUtils.readFully(br); | |||
if (buf == null) { | |||
buf = ""; | |||
} | |||
@@ -62,7 +62,7 @@ public class SubAnt | |||
private Path buildpath; | |||
private Ant ant = null; | |||
private String target = null; | |||
private String subTarget = null; | |||
private String antfile = "build.xml"; | |||
private File genericantfile = null; | |||
private boolean inheritAll = false; | |||
@@ -173,8 +173,8 @@ public class SubAnt | |||
} | |||
/* | |||
//REVISIT: there must be cleaner way of doing this, if it is merited at all | |||
if (target == null) { | |||
target = getOwningTarget().getName(); | |||
if (subTarget == null) { | |||
subTarget = getOwningTarget().getName(); | |||
} | |||
*/ | |||
BuildException buildException = null; | |||
@@ -267,14 +267,14 @@ public class SubAnt | |||
if (failOnError) { | |||
throw e; | |||
} | |||
log("Failure for target '" + target | |||
log("Failure for target '" + subTarget | |||
+ "' of: " + antfilename + "\n" | |||
+ e.getMessage(), Project.MSG_WARN); | |||
} catch (Throwable e) { | |||
if (failOnError) { | |||
throw new BuildException(e); | |||
} | |||
log("Failure for target '" + target | |||
log("Failure for target '" + subTarget | |||
+ "' of: " + antfilename + "\n" | |||
+ e.toString(), | |||
Project.MSG_WARN); | |||
@@ -326,7 +326,7 @@ public class SubAnt | |||
*/ | |||
// REVISIT: Defaults to the target name that contains this task if not specified. | |||
public void setTarget(String target) { | |||
this.target = target; | |||
this.subTarget = target; | |||
} | |||
/** | |||
@@ -484,38 +484,38 @@ public class SubAnt | |||
* references necessary to run the sub-build. | |||
*/ | |||
private Ant createAntTask(File directory) { | |||
Ant ant = (Ant) getProject().createTask("ant"); | |||
ant.setOwningTarget(getOwningTarget()); | |||
ant.setTaskName(getTaskName()); | |||
ant.init(); | |||
if (target != null && target.length() > 0) { | |||
ant.setTarget(target); | |||
Ant antTask = (Ant) getProject().createTask("ant"); | |||
antTask.setOwningTarget(getOwningTarget()); | |||
antTask.setTaskName(getTaskName()); | |||
antTask.init(); | |||
if (subTarget != null && subTarget.length() > 0) { | |||
antTask.setTarget(subTarget); | |||
} | |||
if (output != null) { | |||
ant.setOutput(output); | |||
antTask.setOutput(output); | |||
} | |||
if (directory != null) { | |||
ant.setDir(directory); | |||
antTask.setDir(directory); | |||
} | |||
ant.setInheritAll(inheritAll); | |||
antTask.setInheritAll(inheritAll); | |||
for (Enumeration i = properties.elements(); i.hasMoreElements();) { | |||
copyProperty(ant.createProperty(), (Property) i.nextElement()); | |||
copyProperty(antTask.createProperty(), (Property) i.nextElement()); | |||
} | |||
for (Enumeration i = propertySets.elements(); i.hasMoreElements();) { | |||
ant.addPropertyset((PropertySet) i.nextElement()); | |||
antTask.addPropertyset((PropertySet) i.nextElement()); | |||
} | |||
ant.setInheritRefs(inheritRefs); | |||
antTask.setInheritRefs(inheritRefs); | |||
for (Enumeration i = references.elements(); i.hasMoreElements();) { | |||
ant.addReference((Ant.Reference) i.nextElement()); | |||
antTask.addReference((Ant.Reference) i.nextElement()); | |||
} | |||
return ant; | |||
return antTask; | |||
} | |||
/** | |||
@@ -94,9 +94,9 @@ public class Tar extends MatchingTask { | |||
* @return the tar fileset to be used as the nested element. | |||
*/ | |||
public TarFileSet createTarFileSet() { | |||
TarFileSet fileset = new TarFileSet(); | |||
filesets.addElement(fileset); | |||
return fileset; | |||
TarFileSet fs = new TarFileSet(); | |||
filesets.addElement(fs); | |||
return fs; | |||
} | |||
@@ -750,11 +750,11 @@ public class Tar extends MatchingTask { | |||
*/ | |||
private OutputStream compress(final OutputStream ostream) | |||
throws IOException { | |||
final String value = getValue(); | |||
if (GZIP.equals(value)) { | |||
final String v = getValue(); | |||
if (GZIP.equals(v)) { | |||
return new GZIPOutputStream(ostream); | |||
} else { | |||
if (BZIP2.equals(value)) { | |||
if (BZIP2.equals(v)) { | |||
ostream.write('B'); | |||
ostream.write('Z'); | |||
return new CBZip2OutputStream(ostream); | |||
@@ -164,11 +164,11 @@ public class Untar extends Expand { | |||
private InputStream decompress(final File file, | |||
final InputStream istream) | |||
throws IOException, BuildException { | |||
final String value = getValue(); | |||
if (GZIP.equals(value)) { | |||
final String v = getValue(); | |||
if (GZIP.equals(v)) { | |||
return new GZIPInputStream(istream); | |||
} else { | |||
if (BZIP2.equals(value)) { | |||
if (BZIP2.equals(v)) { | |||
final char[] magic = new char[] {'B', 'Z'}; | |||
for (int i = 0; i < magic.length; i++) { | |||
if (istream.read() != magic[i]) { | |||
@@ -127,7 +127,7 @@ public class WhichResource extends Task { | |||
loader = new AntClassLoader(getProject().getCoreLoader(), | |||
getProject(), | |||
classpath, false); | |||
String location = null; | |||
String loc = null; | |||
if (classname != null) { | |||
//convert a class name into a resource | |||
resource = classname.replace('.', '/') + ".class"; | |||
@@ -146,8 +146,8 @@ public class WhichResource extends Task { | |||
url = loader.getResource(resource); | |||
if (url != null) { | |||
//set the property | |||
location = url.toExternalForm(); | |||
getProject().setNewProperty(property, location); | |||
loc = url.toExternalForm(); | |||
getProject().setNewProperty(property, loc); | |||
} | |||
} | |||
@@ -460,15 +460,15 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
File stylesheet) | |||
throws BuildException { | |||
File outFile = null; | |||
File inFile = null; | |||
File outF = null; | |||
File inF = null; | |||
try { | |||
long styleSheetLastModified = stylesheet.lastModified(); | |||
inFile = new File(baseDir, xmlFile); | |||
inF = new File(baseDir, xmlFile); | |||
if (inFile.isDirectory()) { | |||
log("Skipping " + inFile + " it is a directory.", | |||
if (inF.isDirectory()) { | |||
log("Skipping " + inF + " it is a directory.", | |||
Project.MSG_VERBOSE); | |||
return; | |||
} | |||
@@ -491,23 +491,23 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
return; | |||
} | |||
outFile = new File(destDir, outFileName[0]); | |||
outF = new File(destDir, outFileName[0]); | |||
if (force | |||
|| inFile.lastModified() > outFile.lastModified() | |||
|| styleSheetLastModified > outFile.lastModified()) { | |||
ensureDirectoryFor(outFile); | |||
log("Processing " + inFile + " to " + outFile); | |||
|| inF.lastModified() > outF.lastModified() | |||
|| styleSheetLastModified > outF.lastModified()) { | |||
ensureDirectoryFor(outF); | |||
log("Processing " + inF + " to " + outF); | |||
configureLiaison(stylesheet); | |||
liaison.transform(inFile, outFile); | |||
liaison.transform(inF, outF); | |||
} | |||
} catch (Exception ex) { | |||
// If failed to process document, must delete target document, | |||
// or it will not attempt to process it the second time | |||
log("Failed to process " + inFile, Project.MSG_INFO); | |||
if (outFile != null) { | |||
outFile.delete(); | |||
if (outF != null) { | |||
outF.delete(); | |||
} | |||
throw new BuildException(ex); | |||
@@ -40,8 +40,8 @@ public class WLRmic extends DefaultRmicAdapter { | |||
+ "set the environment variable " | |||
+ "CLASSPATH."; | |||
public static final String ERROR_WLRMIC_FAILED = "Error starting WebLogic rmic: "; | |||
public static final String RMI_STUB_SUFFIX = "_WLStub"; | |||
public static final String RMI_SKEL_SUFFIX = "_WLSkel"; | |||
public static final String WL_RMI_STUB_SUFFIX = "_WLStub"; | |||
public static final String WL_RMI_SKEL_SUFFIX = "_WLSkel"; | |||
public boolean execute() throws BuildException { | |||
getRmic().log("Using WebLogic rmic", Project.MSG_VERBOSE); | |||
@@ -82,13 +82,13 @@ public class WLRmic extends DefaultRmicAdapter { | |||
* Get the suffix for the rmic stub classes | |||
*/ | |||
public String getStubClassSuffix() { | |||
return RMI_STUB_SUFFIX; | |||
return WL_RMI_STUB_SUFFIX; | |||
} | |||
/** | |||
* Get the suffix for the rmic skeleton classes | |||
*/ | |||
public String getSkelClassSuffix() { | |||
return RMI_SKEL_SUFFIX; | |||
return WL_RMI_SKEL_SUFFIX; | |||
} | |||
} |
@@ -304,9 +304,9 @@ public abstract class AbstractFileSet extends DataType implements Cloneable, | |||
*/ | |||
protected String getDataTypeName() { | |||
// look up the types in project and see if they match this class | |||
Project project = getProject(); | |||
if (project != null) { | |||
Hashtable typedefs = project.getDataTypeDefinitions(); | |||
Project p = getProject(); | |||
if (p != null) { | |||
Hashtable typedefs = p.getDataTypeDefinitions(); | |||
for (Enumeration e = typedefs.keys(); e.hasMoreElements();) { | |||
String typeName = (String) e.nextElement(); | |||
Class typeClass = (Class) typedefs.get(typeName); | |||
@@ -106,10 +106,11 @@ public class CommandlineJava implements Cloneable { | |||
listIt.add("-D" + props[i]); | |||
} | |||
} | |||
Properties propertySets = mergePropertySets(); | |||
for (Enumeration e = propertySets.keys(); e.hasMoreElements();) { | |||
Properties propertySetProperties = mergePropertySets(); | |||
for (Enumeration e = propertySetProperties.keys(); | |||
e.hasMoreElements();) { | |||
String key = (String) e.nextElement(); | |||
String value = propertySets.getProperty(key); | |||
String value = propertySetProperties.getProperty(key); | |||
listIt.add("-D" + key + "=" + value); | |||
} | |||
} | |||
@@ -56,11 +56,11 @@ public abstract class EnumeratedAttribute { | |||
* Invoked by {@link org.apache.tools.ant.IntrospectionHelper IntrospectionHelper}. | |||
*/ | |||
public final void setValue(String value) throws BuildException { | |||
int index = indexOfValue(value); | |||
if (index == -1) { | |||
int idx = indexOfValue(value); | |||
if (idx == -1) { | |||
throw new BuildException(value + " is not a legal value for this attribute"); | |||
} | |||
this.index = index; | |||
this.index = idx; | |||
this.value = value; | |||
} | |||
@@ -284,11 +284,11 @@ public class FilterSet extends DataType implements Cloneable { | |||
props.load(in); | |||
Enumeration e = props.propertyNames(); | |||
Vector filters = getFilters(); | |||
Vector filts = getFilters(); | |||
while (e.hasMoreElements()) { | |||
String strPropName = (String) e.nextElement(); | |||
String strValue = props.getProperty(strPropName); | |||
filters.addElement(new Filter(strPropName, strValue)); | |||
filts.addElement(new Filter(strPropName, strValue)); | |||
} | |||
} catch (Exception ex) { | |||
throw new BuildException("Could not read filters from file: " | |||
@@ -198,9 +198,9 @@ public class Mapper extends DataType implements Cloneable { | |||
try { | |||
FileNameMapper m | |||
= (FileNameMapper)(getImplementationClass().newInstance()); | |||
final Project project = getProject(); | |||
if (project != null) { | |||
project.setProjectReference(m); | |||
final Project p = getProject(); | |||
if (p != null) { | |||
p.setProjectReference(m); | |||
} | |||
m.setFrom(from); | |||
m.setTo(to); | |||
@@ -219,16 +219,16 @@ public class Mapper extends DataType implements Cloneable { | |||
*/ | |||
protected Class getImplementationClass() throws ClassNotFoundException { | |||
String classname = this.classname; | |||
String cName = this.classname; | |||
if (type != null) { | |||
classname = type.getImplementation(); | |||
cName = type.getImplementation(); | |||
} | |||
ClassLoader loader = (classpath == null) | |||
? getClass().getClassLoader() | |||
: getProject().createClassLoader(classpath); | |||
return Class.forName(classname, true, loader); | |||
return Class.forName(cName, true, loader); | |||
} | |||
/** | |||
@@ -75,9 +75,9 @@ public class PropertySet extends DataType { | |||
} | |||
public void setBuiltin(BuiltinPropertySetName b) { | |||
String builtin = b.getValue(); | |||
String built_in = b.getValue(); | |||
assertValid("builtin", builtin); | |||
this.builtin = builtin; | |||
this.builtin = built_in; | |||
} | |||
private void assertValid(String attr, String value) { | |||
@@ -99,27 +99,27 @@ public class PropertySet extends DataType { | |||
} //end nested class | |||
public void appendName(String name) { | |||
PropertyRef ref = new PropertyRef(); | |||
ref.setName(name); | |||
addPropertyref(ref); | |||
PropertyRef r = new PropertyRef(); | |||
r.setName(name); | |||
addPropertyref(r); | |||
} | |||
public void appendRegex(String regex) { | |||
PropertyRef ref = new PropertyRef(); | |||
ref.setRegex(regex); | |||
addPropertyref(ref); | |||
PropertyRef r = new PropertyRef(); | |||
r.setRegex(regex); | |||
addPropertyref(r); | |||
} | |||
public void appendPrefix(String prefix) { | |||
PropertyRef ref = new PropertyRef(); | |||
ref.setPrefix(prefix); | |||
addPropertyref(ref); | |||
PropertyRef r = new PropertyRef(); | |||
r.setPrefix(prefix); | |||
addPropertyref(r); | |||
} | |||
public void appendBuiltin(BuiltinPropertySetName b) { | |||
PropertyRef ref = new PropertyRef(); | |||
ref.setBuiltin(b); | |||
addPropertyref(ref); | |||
PropertyRef r = new PropertyRef(); | |||
r.setBuiltin(b); | |||
addPropertyref(r); | |||
} | |||
/** | |||
@@ -256,35 +256,35 @@ public class PropertySet extends DataType { | |||
// Add this PropertySet's property names. | |||
for (Enumeration e = ptyRefs.elements(); e.hasMoreElements();) { | |||
PropertyRef ref = (PropertyRef) e.nextElement(); | |||
if (ref.name != null) { | |||
if (prj != null && prj.getProperty(ref.name) != null) { | |||
names.add(ref.name); | |||
PropertyRef r = (PropertyRef) e.nextElement(); | |||
if (r.name != null) { | |||
if (prj != null && prj.getProperty(r.name) != null) { | |||
names.add(r.name); | |||
} | |||
} else if (ref.prefix != null) { | |||
} else if (r.prefix != null) { | |||
for (Enumeration p = properties.keys(); p.hasMoreElements();) { | |||
String name = (String) p.nextElement(); | |||
if (name.startsWith(ref.prefix)) { | |||
if (name.startsWith(r.prefix)) { | |||
names.add(name); | |||
} | |||
} | |||
} else if (ref.regex != null) { | |||
} else if (r.regex != null) { | |||
RegexpMatcherFactory matchMaker = new RegexpMatcherFactory(); | |||
RegexpMatcher matcher = matchMaker.newRegexpMatcher(); | |||
matcher.setPattern(ref.regex); | |||
matcher.setPattern(r.regex); | |||
for (Enumeration p = properties.keys(); p.hasMoreElements();) { | |||
String name = (String) p.nextElement(); | |||
if (matcher.matches(name)) { | |||
names.add(name); | |||
} | |||
} | |||
} else if (ref.builtin != null) { | |||
} else if (r.builtin != null) { | |||
if (ref.builtin.equals(BuiltinPropertySetName.ALL)) { | |||
if (r.builtin.equals(BuiltinPropertySetName.ALL)) { | |||
names.addAll(properties.keySet()); | |||
} else if (ref.builtin.equals(BuiltinPropertySetName.SYSTEM)) { | |||
} else if (r.builtin.equals(BuiltinPropertySetName.SYSTEM)) { | |||
names.addAll(System.getProperties().keySet()); | |||
} else if (ref.builtin.equals(BuiltinPropertySetName | |||
} else if (r.builtin.equals(BuiltinPropertySetName | |||
.COMMANDLINE)) { | |||
names.addAll(getProject().getUserProperties().keySet()); | |||
} else { | |||
@@ -142,8 +142,8 @@ public class DateSelector extends BaseExtendSelector { | |||
* | |||
* @param cmp The comparison to perform, an EnumeratedAttribute | |||
*/ | |||
public void setWhen(TimeComparisons cmp) { | |||
this.cmp = cmp.getIndex(); | |||
public void setWhen(TimeComparisons tcmp) { | |||
this.cmp = tcmp.getIndex(); | |||
} | |||
/** | |||
@@ -187,9 +187,9 @@ public class DateSelector extends BaseExtendSelector { | |||
+ parameters[i].getValue()); | |||
} | |||
} else if (WHEN_KEY.equalsIgnoreCase(paramname)) { | |||
TimeComparisons cmp = new TimeComparisons(); | |||
cmp.setValue(parameters[i].getValue()); | |||
setWhen(cmp); | |||
TimeComparisons tcmp = new TimeComparisons(); | |||
tcmp.setValue(parameters[i].getValue()); | |||
setWhen(tcmp); | |||
} else if (PATTERN_KEY.equalsIgnoreCase(paramname)) { | |||
setPattern(parameters[i].getValue()); | |||
} else { | |||
@@ -69,9 +69,9 @@ public class ExtendSelector extends BaseSelector { | |||
c = Class.forName(classname, true, al); | |||
} | |||
dynselector = (FileSelector) c.newInstance(); | |||
final Project project = getProject(); | |||
if (project != null) { | |||
project.setProjectReference(dynselector); | |||
final Project p = getProject(); | |||
if (p != null) { | |||
p.setProjectReference(dynselector); | |||
} | |||
} catch (ClassNotFoundException cnfexcept) { | |||
setError("Selector " + classname | |||
@@ -137,8 +137,8 @@ public class SizeSelector extends BaseExtendSelector { | |||
* | |||
* @param cmp The comparison to perform, an EnumeratedAttribute | |||
*/ | |||
public void setWhen(SizeComparisons cmp) { | |||
this.cmp = cmp.getIndex(); | |||
public void setWhen(SizeComparisons scmp) { | |||
this.cmp = scmp.getIndex(); | |||
} | |||
/** | |||
@@ -165,9 +165,9 @@ public class SizeSelector extends BaseExtendSelector { | |||
units.setValue(parameters[i].getValue()); | |||
setUnits(units); | |||
} else if (WHEN_KEY.equalsIgnoreCase(paramname)) { | |||
SizeComparisons cmp = new SizeComparisons(); | |||
cmp.setValue(parameters[i].getValue()); | |||
setWhen(cmp); | |||
SizeComparisons scmp = new SizeComparisons(); | |||
scmp.setValue(parameters[i].getValue()); | |||
setWhen(scmp); | |||
} else { | |||
setError("Invalid parameter " + paramname); | |||
} | |||
@@ -71,9 +71,9 @@ public class TypeSelector extends BaseExtendSelector { | |||
for (int i = 0; i < parameters.length; i++) { | |||
String paramname = parameters[i].getName(); | |||
if (TYPE_KEY.equalsIgnoreCase(paramname)) { | |||
FileType type = new FileType(); | |||
type.setValue(parameters[i].getValue()); | |||
setType(type); | |||
FileType t = new FileType(); | |||
t.setValue(parameters[i].getValue()); | |||
setType(t); | |||
} else { | |||
setError("Invalid parameter " + paramname); | |||
} | |||
@@ -359,12 +359,12 @@ public class ModifiedSelector extends BaseExtendSelector implements BuildListene | |||
// | |||
// ----- Set default values ----- | |||
// | |||
Project project = getProject(); | |||
Project p = getProject(); | |||
String filename = "cache.properties"; | |||
File cachefile = null; | |||
if (project != null) { | |||
if (p != null) { | |||
// normal use inside Ant | |||
cachefile = new File(project.getBaseDir(), filename); | |||
cachefile = new File(p.getBaseDir(), filename); | |||
// set self as a BuildListener to delay cachefile saves | |||
getProject().addBuildListener(this); | |||
@@ -126,7 +126,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants { | |||
private int computedBlockCRC, computedCombinedCRC; | |||
int i2, count, chPrev, ch2; | |||
int global_i, tPos; | |||
int tPos; | |||
int rNToGo = 0; | |||
int rTPos = 0; | |||
int j2; | |||
@@ -205,7 +205,7 @@ public class TarEntry implements TarConstants { | |||
this.file = file; | |||
String name = file.getPath(); | |||
String fileName = file.getPath(); | |||
String osname = System.getProperty("os.name").toLowerCase(Locale.US); | |||
if (osname != null) { | |||
@@ -214,35 +214,35 @@ public class TarEntry implements TarConstants { | |||
// REVIEW Would a better check be "(File.separator == '\')"? | |||
if (osname.startsWith("windows")) { | |||
if (name.length() > 2) { | |||
char ch1 = name.charAt(0); | |||
char ch2 = name.charAt(1); | |||
if (fileName.length() > 2) { | |||
char ch1 = fileName.charAt(0); | |||
char ch2 = fileName.charAt(1); | |||
if (ch2 == ':' | |||
&& ((ch1 >= 'a' && ch1 <= 'z') | |||
|| (ch1 >= 'A' && ch1 <= 'Z'))) { | |||
name = name.substring(2); | |||
fileName = fileName.substring(2); | |||
} | |||
} | |||
} else if (osname.indexOf("netware") > -1) { | |||
int colon = name.indexOf(':'); | |||
int colon = fileName.indexOf(':'); | |||
if (colon != -1) { | |||
name = name.substring(colon + 1); | |||
fileName = fileName.substring(colon + 1); | |||
} | |||
} | |||
} | |||
name = name.replace(File.separatorChar, '/'); | |||
fileName = fileName.replace(File.separatorChar, '/'); | |||
// No absolute pathnames | |||
// Windows (and Posix?) paths can start with "\\NetworkDrive\", | |||
// so we loop on starting /'s. | |||
while (name.startsWith("/")) { | |||
name = name.substring(1); | |||
while (fileName.startsWith("/")) { | |||
fileName = fileName.substring(1); | |||
} | |||
this.linkName = new StringBuffer(""); | |||
this.name = new StringBuffer(name); | |||
this.name = new StringBuffer(fileName); | |||
if (file.isDirectory()) { | |||
this.mode = DEFAULT_DIR_MODE; | |||
@@ -600,9 +600,9 @@ public class TarEntry implements TarConstants { | |||
outbuf[offset++] = 0; | |||
} | |||
long checkSum = TarUtils.computeCheckSum(outbuf); | |||
long chk = TarUtils.computeCheckSum(outbuf); | |||
TarUtils.getCheckSumOctalBytes(checkSum, outbuf, csOffset, CHKSUMLEN); | |||
TarUtils.getCheckSumOctalBytes(chk, outbuf, csOffset, CHKSUMLEN); | |||
} | |||
/** | |||
@@ -230,10 +230,10 @@ public class TarInputStream extends FilterInputStream { | |||
if (this.currEntry != null && this.currEntry.isGNULongNameEntry()) { | |||
// read in the name | |||
StringBuffer longName = new StringBuffer(); | |||
byte[] buffer = new byte[256]; | |||
byte[] buf = new byte[256]; | |||
int length = 0; | |||
while ((length = read(buffer)) >= 0) { | |||
longName.append(new String(buffer, 0, length)); | |||
while ((length = read(buf)) >= 0) { | |||
longName.append(new String(buf, 0, length)); | |||
} | |||
getNextEntry(); | |||
@@ -473,9 +473,9 @@ public class ZipOutputStream extends FilterOutputStream { | |||
* @since 1.14 | |||
*/ | |||
public void write(int b) throws IOException { | |||
byte[] buf = new byte[1]; | |||
buf[0] = (byte) (b & 0xff); | |||
write(buf, 0, 1); | |||
byte[] buff = new byte[1]; | |||
buff[0] = (byte) (b & 0xff); | |||
write(buff, 0, 1); | |||
} | |||
/** | |||
@@ -694,8 +694,8 @@ public class ZipOutputStream extends FilterOutputStream { | |||
if (comm == null) { | |||
comm = ""; | |||
} | |||
byte[] comment = getBytes(comm); | |||
writeOut((new ZipShort(comment.length)).getBytes()); | |||
byte[] commentB = getBytes(comm); | |||
writeOut((new ZipShort(commentB.length)).getBytes()); | |||
written += 2; | |||
// disk number start | |||
@@ -723,8 +723,8 @@ public class ZipOutputStream extends FilterOutputStream { | |||
written += extra.length; | |||
// file comment | |||
writeOut(comment); | |||
written += comment.length; | |||
writeOut(commentB); | |||
written += commentB.length; | |||
} | |||
/** | |||