From bcc7e3dff34ce66d4f1af34c5d5fbb1603808210 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 15 Nov 2004 14:52:27 +0000 Subject: [PATCH] More Jikes warnings git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277036 13f79535-47bb-0310-9956-ffa450edef68 --- .../tools/ant/listener/AnsiColorLogger.java | 6 ++-- .../ant/taskdefs/optional/PropertyFile.java | 18 +++++------ .../ant/taskdefs/optional/ReplaceRegExp.java | 2 +- .../taskdefs/optional/ccm/CCMReconfigure.java | 6 ++-- .../optional/clearcase/ClearCase.java | 4 +-- .../optional/ejb/GenericDeploymentTool.java | 8 ++--- .../optional/ejb/JonasDeploymentTool.java | 10 +++---- .../extension/JarLibManifestTask.java | 4 +-- .../ant/taskdefs/optional/javacc/JJDoc.java | 20 ++++++------- .../ant/taskdefs/optional/javacc/JJTree.java | 24 +++++++-------- .../ant/taskdefs/optional/javacc/JavaCC.java | 20 ++++++------- .../taskdefs/optional/junit/JUnitTask.java | 10 +++---- .../metamata/AbstractMetamataTask.java | 4 +-- .../taskdefs/optional/metamata/MParse.java | 30 +++++++++---------- 14 files changed, 83 insertions(+), 83 deletions(-) diff --git a/src/main/org/apache/tools/ant/listener/AnsiColorLogger.java b/src/main/org/apache/tools/ant/listener/AnsiColorLogger.java index 49a9f2e8d..f16f8d524 100644 --- a/src/main/org/apache/tools/ant/listener/AnsiColorLogger.java +++ b/src/main/org/apache/tools/ant/listener/AnsiColorLogger.java @@ -164,13 +164,13 @@ public final class AnsiColorLogger extends DefaultLogger { prop.load(in); } - String err = prop.getProperty("AnsiColorLogger.ERROR_COLOR"); + String errC = prop.getProperty("AnsiColorLogger.ERROR_COLOR"); String warn = prop.getProperty("AnsiColorLogger.WARNING_COLOR"); String info = prop.getProperty("AnsiColorLogger.INFO_COLOR"); String verbose = prop.getProperty("AnsiColorLogger.VERBOSE_COLOR"); String debug = prop.getProperty("AnsiColorLogger.DEBUG_COLOR"); - if (err != null) { - errColor = PREFIX + err + SUFFIX; + if (errC != null) { + errColor = PREFIX + errC + SUFFIX; } if (warn != null) { warnColor = PREFIX + warn + SUFFIX; diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java b/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java index a96c36b2b..9a7cb4e49 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java @@ -397,7 +397,7 @@ public class PropertyFile extends Task { */ private void executeInteger(String oldValue) throws BuildException { int currentValue = DEFAULT_INT_VALUE; - int newValue = DEFAULT_INT_VALUE; + int newV = DEFAULT_INT_VALUE; DecimalFormat fmt = (pattern != null) ? new DecimalFormat(pattern) @@ -416,7 +416,7 @@ public class PropertyFile extends Task { } if (operation == Operation.EQUALS_OPER) { - newValue = currentValue; + newV = currentValue; } else { int operationValue = 1; if (value != null) { @@ -430,13 +430,13 @@ public class PropertyFile extends Task { } if (operation == Operation.INCREMENT_OPER) { - newValue = currentValue + operationValue; + newV = currentValue + operationValue; } else if (operation == Operation.DECREMENT_OPER) { - newValue = currentValue - operationValue; + newV = currentValue - operationValue; } } - this.newValue = fmt.format(newValue); + this.newValue = fmt.format(newV); } /** @@ -447,7 +447,7 @@ public class PropertyFile extends Task { * not contained in the property file. */ private void executeString(String oldValue) throws BuildException { - String newValue = DEFAULT_STRING_VALUE; + String newV = DEFAULT_STRING_VALUE; String currentValue = getCurrentValue(oldValue); @@ -456,11 +456,11 @@ public class PropertyFile extends Task { } if (operation == Operation.EQUALS_OPER) { - newValue = currentValue; + newV = currentValue; } else if (operation == Operation.INCREMENT_OPER) { - newValue = currentValue + value; + newV = currentValue + value; } - this.newValue = newValue; + this.newValue = newV; } /** diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java b/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java index e5855f716..ef078a9ab 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java @@ -422,7 +422,7 @@ public class ReplaceRegExp extends Task { pw.flush(); } else { - String buf = fileUtils.readFully(br); + String buf = FileUtils.readFully(br); if (buf == null) { buf = ""; } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java index e0807111b..558cf2a1e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java @@ -28,7 +28,7 @@ import org.apache.tools.ant.types.Commandline; */ public class CCMReconfigure extends Continuus { - private String project = null; + private String ccmProject = null; private boolean recurse = false; private boolean verbose = false; @@ -89,7 +89,7 @@ public class CCMReconfigure extends Continuus { * @return value of project. */ public String getCcmProject() { - return project; + return ccmProject; } /** @@ -97,7 +97,7 @@ public class CCMReconfigure extends Continuus { * @param v Value to assign to project. */ public void setCcmProject(String v) { - this.project = v; + this.ccmProject = v; } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java index b2e308234..1fcac74e0 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java @@ -54,7 +54,7 @@ public abstract class ClearCase extends Task { * @param dir the directory containing the cleartool executable */ public final void setClearToolDir(String dir) { - mClearToolDir = getProject().translatePath(dir); + mClearToolDir = Project.translatePath(dir); } /** @@ -149,7 +149,7 @@ public abstract class ClearCase extends Task { Commandline.Argument arg = exe.createArg(); exe.setExecutable(cmdline.getExecutable()); - arg.setLine(cmdline.toString(cmdline.getArguments())); + arg.setLine(Commandline.toString(cmdline.getArguments())); exe.setOutputproperty(outV); exe.execute(); // System.out.println( "runS: " + outV + " : " + aProj.getProperty( outV )); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java index f8ec9dacd..3f077765f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java @@ -354,16 +354,16 @@ public class GenericDeploymentTool implements EJBDeploymentTool { } protected DescriptorHandler getDescriptorHandler(File srcDir) { - DescriptorHandler handler = new DescriptorHandler(getTask(), srcDir); + DescriptorHandler h = new DescriptorHandler(getTask(), srcDir); - registerKnownDTDs(handler); + registerKnownDTDs(h); // register any DTDs supplied by the user for (Iterator i = getConfig().dtdLocations.iterator(); i.hasNext();) { EjbJar.DTDLocation dtdLocation = (EjbJar.DTDLocation) i.next(); - handler.registerDTD(dtdLocation.getPublicId(), dtdLocation.getLocation()); + h.registerDTD(dtdLocation.getPublicId(), dtdLocation.getLocation()); } - return handler; + return h; } /** diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java index 12c604e1b..f9dee6936 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java @@ -392,7 +392,7 @@ public class JonasDeploymentTool extends GenericDeploymentTool { // examples = /org/objectweb/fooAppli/foo/Foo-ejb-jar.xml // examples = /org/objectweb/fooAppli/foo/Foo.xml (JOnAS convention) - String jonasDescriptorName; // JOnAS-specific DD + String jonasDN; // JOnAS-specific DD boolean jonasConvention = false; // true if the JOnAS convention is used for the DD String path; // Directory path of the EJB descriptor String fileName; // EJB descriptor file name @@ -439,15 +439,15 @@ public class JonasDeploymentTool extends GenericDeploymentTool { remainder = descriptorName.substring(endOfBaseName + 1); if (jonasConvention) { - jonasDescriptorName = path + "jonas-" + baseName + ".xml"; + jonasDN = path + "jonas-" + baseName + ".xml"; } else { - jonasDescriptorName = path + baseName + "jonas-" + remainder; + jonasDN = path + baseName + "jonas-" + remainder; } log("Standard EJB descriptor name: " + descriptorName, Project.MSG_VERBOSE); - log("JOnAS-specific descriptor name: " + jonasDescriptorName, Project.MSG_VERBOSE); + log("JOnAS-specific descriptor name: " + jonasDN, Project.MSG_VERBOSE); - return jonasDescriptorName; + return jonasDN; } protected String getJarBaseName(String descriptorFileName) { diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibManifestTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibManifestTask.java index e4b4eeb1d..27c3ba7ec 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibManifestTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibManifestTask.java @@ -256,9 +256,9 @@ public final class JarLibManifestTask extends Task { throws BuildException { final int size = extensions.size(); for (int i = 0; i < size; i++) { - final Extension extension = (Extension) extensions.get(i); + final Extension ext = (Extension) extensions.get(i); final String prefix = listPrefix + i + "-"; - Extension.addExtension(extension, prefix, attributes); + Extension.addExtension(ext, prefix, attributes); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java b/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java index c9d786f76..f13f81b38 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java @@ -51,7 +51,7 @@ public class JJDoc extends Task { private static final String DEFAULT_SUFFIX_TEXT = ".txt"; // required attributes - private File target = null; + private File targetFile = null; private File javaccHome = null; private CommandlineJava cmdl = new CommandlineJava(); @@ -85,7 +85,7 @@ public class JJDoc extends Task { * The javacc grammar file to process. */ public void setTarget(File target) { - this.target = target; + this.targetFile = target; } /** @@ -110,8 +110,8 @@ public class JJDoc extends Task { .setValue("-" + name + ":" + value.toString()); } - if (target == null || !target.isFile()) { - throw new BuildException("Invalid target: " + target); + if (targetFile == null || !targetFile.isFile()) { + throw new BuildException("Invalid target: " + targetFile); } if (outputFile != null) { @@ -120,17 +120,17 @@ public class JJDoc extends Task { } // use the directory containing the target as the output directory - File javaFile = new File(createOutputFileName(target, outputFile, + File javaFile = new File(createOutputFileName(targetFile, outputFile, plainText)); if (javaFile.exists() - && target.lastModified() < javaFile.lastModified()) { - log("Target is already built - skipping (" + target + ")", + && targetFile.lastModified() < javaFile.lastModified()) { + log("Target is already built - skipping (" + targetFile + ")", Project.MSG_VERBOSE); return; } - cmdl.createArgument().setValue(target.getAbsolutePath()); + cmdl.createArgument().setValue(targetFile.getAbsolutePath()); final Path classpath = cmdl.createClasspath(getProject()); final File javaccJar = JavaCC.getArchiveFile(javaccHome); @@ -161,10 +161,10 @@ public class JJDoc extends Task { } } - private String createOutputFileName(File target, String optionalOutputFile, + private String createOutputFileName(File targetFile, String optionalOutputFile, boolean plainText) { String suffix = DEFAULT_SUFFIX_HTML; - String javaccFile = target.getAbsolutePath().replace('\\', '/'); + String javaccFile = targetFile.getAbsolutePath().replace('\\', '/'); if (plainText) { suffix = DEFAULT_SUFFIX_TEXT; diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java b/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java index ec9bc4601..3721bc8ba 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java @@ -60,7 +60,7 @@ public class JJTree extends Task { // required attributes private File outputDirectory = null; - private File target = null; + private File targetFile = null; private File javaccHome = null; private CommandlineJava cmdl = new CommandlineJava(); @@ -164,8 +164,8 @@ public class JJTree extends Task { /** * The jjtree grammar file to process. */ - public void setTarget(File target) { - this.target = target; + public void setTarget(File targetFile) { + this.targetFile = targetFile; } /** @@ -189,8 +189,8 @@ public class JJTree extends Task { cmdl.createArgument().setValue("-" + name + ":" + value.toString()); } - if (target == null || !target.isFile()) { - throw new BuildException("Invalid target: " + target); + if (targetFile == null || !targetFile.isFile()) { + throw new BuildException("Invalid target: " + targetFile); } File javaFile = null; @@ -202,7 +202,7 @@ public class JJTree extends Task { cmdl.createArgument().setValue("-OUTPUT_DIRECTORY:" + getDefaultOutputDirectory()); - javaFile = new File(createOutputFileName(target, outputFile, + javaFile = new File(createOutputFileName(targetFile, outputFile, null)); } else { if (!outputDirectory.isDirectory()) { @@ -216,14 +216,14 @@ public class JJTree extends Task { + outputDirectory.getAbsolutePath() .replace('\\', '/')); - javaFile = new File(createOutputFileName(target, outputFile, + javaFile = new File(createOutputFileName(targetFile, outputFile, outputDirectory .getPath())); } if (javaFile.exists() - && target.lastModified() < javaFile.lastModified()) { - log("Target is already built - skipping (" + target + ")", + && targetFile.lastModified() < javaFile.lastModified()) { + log("Target is already built - skipping (" + targetFile + ")", Project.MSG_VERBOSE); return; } @@ -233,7 +233,7 @@ public class JJTree extends Task { + outputFile.replace('\\', '/')); } - cmdl.createArgument().setValue(target.getAbsolutePath()); + cmdl.createArgument().setValue(targetFile.getAbsolutePath()); final Path classpath = cmdl.createClasspath(getProject()); final File javaccJar = JavaCC.getArchiveFile(javaccHome); @@ -264,11 +264,11 @@ public class JJTree extends Task { } } - private String createOutputFileName(File target, String optionalOutputFile, + private String createOutputFileName(File targetFile, String optionalOutputFile, String outputDirectory) { optionalOutputFile = validateOutputFile(optionalOutputFile, outputDirectory); - String jjtreeFile = target.getAbsolutePath().replace('\\', '/'); + String jjtreeFile = targetFile.getAbsolutePath().replace('\\', '/'); if ((optionalOutputFile == null) || optionalOutputFile.equals("")) { int filePos = jjtreeFile.lastIndexOf("/"); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java b/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java index 0e722c1ff..834cd7192 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java @@ -67,7 +67,7 @@ public class JavaCC extends Task { // required attributes private File outputDirectory = null; - private File target = null; + private File targetFile = null; private File javaccHome = null; private CommandlineJava cmdl = new CommandlineJava(); @@ -262,8 +262,8 @@ public class JavaCC extends Task { /** * The grammar file to process. */ - public void setTarget(File target) { - this.target = target; + public void setTarget(File targetFile) { + this.targetFile = targetFile; } /** @@ -288,13 +288,13 @@ public class JavaCC extends Task { } // check the target is a file - if (target == null || !target.isFile()) { - throw new BuildException("Invalid target: " + target); + if (targetFile == null || !targetFile.isFile()) { + throw new BuildException("Invalid target: " + targetFile); } // use the directory containing the target as the output directory if (outputDirectory == null) { - outputDirectory = new File(target.getParent()); + outputDirectory = new File(targetFile.getParent()); } else if (!outputDirectory.isDirectory()) { throw new BuildException("Outputdir not a directory."); } @@ -302,12 +302,12 @@ public class JavaCC extends Task { + outputDirectory.getAbsolutePath()); // determine if the generated java file is up-to-date - final File javaFile = getOutputJavaFile(outputDirectory, target); - if (javaFile.exists() && target.lastModified() < javaFile.lastModified()) { - log("Target is already built - skipping (" + target + ")", Project.MSG_VERBOSE); + final File javaFile = getOutputJavaFile(outputDirectory, targetFile); + if (javaFile.exists() && targetFile.lastModified() < javaFile.lastModified()) { + log("Target is already built - skipping (" + targetFile + ")", Project.MSG_VERBOSE); return; } - cmdl.createArgument().setValue(target.getAbsolutePath()); + cmdl.createArgument().setValue(targetFile.getAbsolutePath()); final Path classpath = cmdl.createClasspath(getProject()); final File javaccJar = JavaCC.getArchiveFile(javaccHome); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java index 094f422d8..14ccb78ae 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java @@ -334,11 +334,11 @@ public class JUnitTask extends Task { * @return boolean equivalent of the value */ public boolean asBoolean() { - String value = getValue(); - return "true".equals(value) - || "on".equals(value) - || "yes".equals(value) - || "withOutAndErr".equals(value); + String v = getValue(); + return "true".equals(v) + || "on".equals(v) + || "yes".equals(v) + || "withOutAndErr".equals(v); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java index f98dc4a79..a5d63f99d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java @@ -174,8 +174,8 @@ public abstract class AbstractMetamataTask extends Task { // set the classpath as the jar file File jar = getMetamataJar(metamataHome); - final Path classPath = cmdl.createClasspath(getProject()); - classPath.createPathElement().setLocation(jar); + final Path cp = cmdl.createClasspath(getProject()); + cp.createPathElement().setLocation(jar); // set the metamata.home property final Commandline.Argument vmArgs = cmdl.createVmArgument(); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java b/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java index c8b8d3ba8..37feca983 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java @@ -43,15 +43,15 @@ import org.apache.tools.ant.util.JavaEnvUtils; */ public class MParse extends AbstractMetamataTask { - private File target = null; + private File targetFile = null; private boolean verbose = false; private boolean debugparser = false; private boolean debugscanner = false; private boolean cleanup = false; /** The .jj file to process; required. */ - public void setTarget(File target) { - this.target = target; + public void setTarget(File targetFile) { + this.targetFile = targetFile; } /** set verbose mode */ @@ -106,9 +106,9 @@ public class MParse extends AbstractMetamataTask { // set the classpath as the jar files File[] jars = getMetamataLibs(); - final Path classPath = cmdl.createClasspath(getProject()); + final Path cp = cmdl.createClasspath(getProject()); for (int i = 0; i < jars.length; i++) { - classPath.createPathElement().setLocation(jars[i]); + cp.createPathElement().setLocation(jars[i]); } // set the metamata.home property @@ -132,12 +132,12 @@ public class MParse extends AbstractMetamataTask { protected void _execute(ExecuteStreamHandler handler) throws BuildException { // target has been checked as a .jj, see if there is a matching // java file and if it is needed to run to process the grammar - String pathname = target.getAbsolutePath(); + String pathname = targetFile.getAbsolutePath(); int pos = pathname.length() - ".jj".length(); pathname = pathname.substring(0, pos) + ".java"; File javaFile = new File(pathname); - if (javaFile.exists() && target.lastModified() < javaFile.lastModified()) { - getProject().log("Target is already build - skipping (" + target + ")"); + if (javaFile.exists() && targetFile.lastModified() < javaFile.lastModified()) { + getProject().log("Target is already build - skipping (" + targetFile + ")"); return; } @@ -160,10 +160,10 @@ public class MParse extends AbstractMetamataTask { optionsFile = null; } if (cleanup) { - String name = target.getName(); + String name = targetFile.getName(); int pos = name.length() - ".jj".length(); name = "__jj" + name.substring(0, pos) + ".sunjj"; - final File sunjj = new File(target.getParent(), name); + final File sunjj = new File(targetFile.getParent(), name); if (sunjj.exists()) { getProject().log("Removing stale file: " + sunjj.getName()); sunjj.delete(); @@ -210,11 +210,11 @@ public class MParse extends AbstractMetamataTask { } // check that the target is ok and resolve it. - if (target == null || !target.isFile() - || !target.getName().endsWith(".jj")) { - throw new BuildException("Invalid target: " + target); + if (targetFile == null || !targetFile.isFile() + || !targetFile.getName().endsWith(".jj")) { + throw new BuildException("Invalid target: " + targetFile); } - target = getProject().resolveFile(target.getPath()); + targetFile = getProject().resolveFile(targetFile.getPath()); } /** @@ -240,7 +240,7 @@ public class MParse extends AbstractMetamataTask { options.addElement("-sourcepath"); options.addElement(sourcePath.toString()); } - options.addElement(target.getAbsolutePath()); + options.addElement(targetFile.getAbsolutePath()); return options; }