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