git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277184 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -47,7 +47,7 @@ public class ANTLR extends Task { | |||||
| private CommandlineJava commandline = new CommandlineJava(); | private CommandlineJava commandline = new CommandlineJava(); | ||||
| /** the file to process */ | /** the file to process */ | ||||
| private File target; | |||||
| private File targetFile; | |||||
| /** where to output the result */ | /** where to output the result */ | ||||
| private File outputDirectory; | private File outputDirectory; | ||||
| @@ -97,7 +97,7 @@ public class ANTLR extends Task { | |||||
| */ | */ | ||||
| public void setTarget(File target) { | public void setTarget(File target) { | ||||
| log("Setting target to: " + target.toString(), Project.MSG_VERBOSE); | log("Setting target to: " + target.toString(), Project.MSG_VERBOSE); | ||||
| this.target = target; | |||||
| this.targetFile = target; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -262,19 +262,19 @@ public class ANTLR extends Task { | |||||
| //TODO: use ANTLR to parse the grammar file to do this. | //TODO: use ANTLR to parse the grammar file to do this. | ||||
| File generatedFile = getGeneratedFile(); | File generatedFile = getGeneratedFile(); | ||||
| boolean targetIsOutOfDate = | boolean targetIsOutOfDate = | ||||
| target.lastModified() > generatedFile.lastModified(); | |||||
| targetFile.lastModified() > generatedFile.lastModified(); | |||||
| boolean superGrammarIsOutOfDate = superGrammar != null | boolean superGrammarIsOutOfDate = superGrammar != null | ||||
| && (superGrammar.lastModified() > generatedFile.lastModified()); | && (superGrammar.lastModified() > generatedFile.lastModified()); | ||||
| if (targetIsOutOfDate || superGrammarIsOutOfDate) { | if (targetIsOutOfDate || superGrammarIsOutOfDate) { | ||||
| if (targetIsOutOfDate) { | if (targetIsOutOfDate) { | ||||
| log("Compiling " + target + " as it is newer than " | |||||
| log("Compiling " + targetFile + " as it is newer than " | |||||
| + generatedFile, Project.MSG_VERBOSE); | + generatedFile, Project.MSG_VERBOSE); | ||||
| } else if (superGrammarIsOutOfDate) { | } else if (superGrammarIsOutOfDate) { | ||||
| log("Compiling " + target + " as " + superGrammar | |||||
| log("Compiling " + targetFile + " as " + superGrammar | |||||
| + " is newer than " + generatedFile, Project.MSG_VERBOSE); | + " is newer than " + generatedFile, Project.MSG_VERBOSE); | ||||
| } | } | ||||
| populateAttributes(); | populateAttributes(); | ||||
| commandline.createArgument().setValue(target.toString()); | |||||
| commandline.createArgument().setValue(targetFile.toString()); | |||||
| log(commandline.describeCommand(), Project.MSG_VERBOSE); | log(commandline.describeCommand(), Project.MSG_VERBOSE); | ||||
| int err = run(commandline.getCommandline()); | int err = run(commandline.getCommandline()); | ||||
| @@ -332,13 +332,13 @@ public class ANTLR extends Task { | |||||
| } | } | ||||
| private void validateAttributes() throws BuildException { | private void validateAttributes() throws BuildException { | ||||
| if (target == null || !target.isFile()) { | |||||
| throw new BuildException("Invalid target: " + target); | |||||
| if (targetFile == null || !targetFile.isFile()) { | |||||
| throw new BuildException("Invalid target: " + targetFile); | |||||
| } | } | ||||
| // if no output directory is specified, used the target's directory | // if no output directory is specified, used the target's directory | ||||
| if (outputDirectory == null) { | if (outputDirectory == null) { | ||||
| setOutputdirectory(new File(target.getParent())); | |||||
| setOutputdirectory(new File(targetFile.getParent())); | |||||
| } | } | ||||
| if (!outputDirectory.isDirectory()) { | if (!outputDirectory.isDirectory()) { | ||||
| throw new BuildException("Invalid output directory: " + outputDirectory); | throw new BuildException("Invalid output directory: " + outputDirectory); | ||||
| @@ -348,7 +348,7 @@ public class ANTLR extends Task { | |||||
| private File getGeneratedFile() throws BuildException { | private File getGeneratedFile() throws BuildException { | ||||
| String generatedFileName = null; | String generatedFileName = null; | ||||
| try { | try { | ||||
| BufferedReader in = new BufferedReader(new FileReader(target)); | |||||
| BufferedReader in = new BufferedReader(new FileReader(targetFile)); | |||||
| String line; | String line; | ||||
| while ((line = in.readLine()) != null) { | while ((line = in.readLine()) != null) { | ||||
| int extendsIndex = line.indexOf(" extends "); | int extendsIndex = line.indexOf(" extends "); | ||||
| @@ -474,9 +474,9 @@ public class JDependTask extends Task { | |||||
| // of sourcespath. The code is currently the same - you | // of sourcespath. The code is currently the same - you | ||||
| // need class files in a directory to use this - jar files | // need class files in a directory to use this - jar files | ||||
| // coming soon.... | // coming soon.... | ||||
| String[] classesPath = getClassespath().list(); | |||||
| for (int i = 0; i < classesPath.length; i++) { | |||||
| File f = new File(classesPath[i]); | |||||
| String[] cP = getClassespath().list(); | |||||
| for (int i = 0; i < cP.length; i++) { | |||||
| File f = new File(cP[i]); | |||||
| // not necessary as JDepend would fail, but why loose | // not necessary as JDepend would fail, but why loose | ||||
| // some time? | // some time? | ||||
| if (!f.exists() || !f.isDirectory()) { | if (!f.exists() || !f.isDirectory()) { | ||||
| @@ -502,9 +502,9 @@ public class JDependTask extends Task { | |||||
| // This is the old way and is deprecated - classespath is | // This is the old way and is deprecated - classespath is | ||||
| // the right way to do this and is above | // the right way to do this and is above | ||||
| String[] sourcesPath = getSourcespath().list(); | |||||
| for (int i = 0; i < sourcesPath.length; i++) { | |||||
| File f = new File(sourcesPath[i]); | |||||
| String[] sP = getSourcespath().list(); | |||||
| for (int i = 0; i < sP.length; i++) { | |||||
| File f = new File(sP[i]); | |||||
| // not necessary as JDepend would fail, but why loose | // not necessary as JDepend would fail, but why loose | ||||
| // some time? | // some time? | ||||
| @@ -618,9 +618,9 @@ public class JDependTask extends Task { | |||||
| if (getSourcespath() != null) { | if (getSourcespath() != null) { | ||||
| // This is deprecated - use classespath in the future | // This is deprecated - use classespath in the future | ||||
| String[] sourcesPath = getSourcespath().list(); | |||||
| for (int i = 0; i < sourcesPath.length; i++) { | |||||
| File f = new File(sourcesPath[i]); | |||||
| String[] sP = getSourcespath().list(); | |||||
| for (int i = 0; i < sP.length; i++) { | |||||
| File f = new File(sP[i]); | |||||
| // not necessary as JDepend would fail, but why loose | // not necessary as JDepend would fail, but why loose | ||||
| // some time? | // some time? | ||||
| @@ -637,9 +637,9 @@ public class JDependTask extends Task { | |||||
| if (getClassespath() != null) { | if (getClassespath() != null) { | ||||
| // This is the new way - use classespath - code is the | // This is the new way - use classespath - code is the | ||||
| // same for now | // same for now | ||||
| String[] classesPath = getClassespath().list(); | |||||
| for (int i = 0; i < classesPath.length; i++) { | |||||
| File f = new File(classesPath[i]); | |||||
| String[] cP = getClassespath().list(); | |||||
| for (int i = 0; i < cP.length; i++) { | |||||
| File f = new File(cP[i]); | |||||
| // not necessary as JDepend would fail, but why loose | // not necessary as JDepend would fail, but why loose | ||||
| // some time? | // some time? | ||||
| if (!f.exists() || !f.isDirectory()) { | if (!f.exists() || !f.isDirectory()) { | ||||
| @@ -223,13 +223,13 @@ public class ScriptDef extends DefBase { | |||||
| // find the script repository - it is stored in the project | // find the script repository - it is stored in the project | ||||
| Map scriptRepository = null; | Map scriptRepository = null; | ||||
| Project project = getProject(); | |||||
| synchronized (project) { | |||||
| Project p = getProject(); | |||||
| synchronized (p) { | |||||
| scriptRepository = | scriptRepository = | ||||
| (Map) project.getReference(MagicNames.SCRIPT_REPOSITORY); | |||||
| (Map) p.getReference(MagicNames.SCRIPT_REPOSITORY); | |||||
| if (scriptRepository == null) { | if (scriptRepository == null) { | ||||
| scriptRepository = new HashMap(); | scriptRepository = new HashMap(); | ||||
| project.addReference(MagicNames.SCRIPT_REPOSITORY, | |||||
| p.addReference(MagicNames.SCRIPT_REPOSITORY, | |||||
| scriptRepository); | scriptRepository); | ||||
| } | } | ||||
| } | } | ||||
| @@ -31,8 +31,8 @@ import com.jcraft.jsch.Channel; | |||||
| public class ScpFromMessage extends AbstractSshMessage { | public class ScpFromMessage extends AbstractSshMessage { | ||||
| private final byte LINE_FEED = 0x0a; | |||||
| private final int BUFFER_SIZE = 1024; | |||||
| private static final byte LINE_FEED = 0x0a; | |||||
| private static final int BUFFER_SIZE = 1024; | |||||
| private String remoteFile; | private String remoteFile; | ||||
| private File localFile; | private File localFile; | ||||
| @@ -30,7 +30,7 @@ import java.util.Iterator; | |||||
| public class ScpToMessage extends AbstractSshMessage { | public class ScpToMessage extends AbstractSshMessage { | ||||
| private final int BUFFER_SIZE = 1024; | |||||
| private static final int BUFFER_SIZE = 1024; | |||||
| private File localFile; | private File localFile; | ||||
| private String remotePath; | private String remotePath; | ||||