Browse Source

Changes after static code analysis.

Code changed.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@526542 13f79535-47bb-0310-9956-ffa450edef68
master
Jacobus Martinus Kruithof 18 years ago
parent
commit
a664a97520
5 changed files with 19 additions and 11 deletions
  1. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/Manifest.java
  2. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/Property.java
  3. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java
  4. +14
    -4
      src/main/org/apache/tools/ant/util/ReflectUtil.java
  5. +1
    -3
      src/main/org/apache/tools/ant/util/ScriptRunnerCreator.java

+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/Manifest.java View File

@@ -182,8 +182,7 @@ public class Manifest {
String lhsKey = getKey();
String rhsKey = rhsAttribute.getKey();
if ((lhsKey == null && rhsKey != null)
|| (lhsKey != null && rhsKey == null)
|| !lhsKey.equals(rhsKey)) {
|| (lhsKey != null && !lhsKey.equals(rhsKey))) {
return false;
}



+ 2
- 1
src/main/org/apache/tools/ant/taskdefs/Property.java View File

@@ -452,8 +452,9 @@ public class Property extends Task {
log("Loading " + file.getAbsolutePath(), Project.MSG_VERBOSE);
try {
if (file.exists()) {
FileInputStream fis = new FileInputStream(file);
FileInputStream fis = null;
try {
fis = new FileInputStream(file);
props.load(fis);
} finally {
if (fis != null) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java View File

@@ -134,9 +134,9 @@ public class P4Fstat extends P4Base {
DirectoryScanner ds = fs.getDirectoryScanner(getProject());

String[] srcFiles = ds.getIncludedFiles();
fileNum = srcFiles.length;

if (srcFiles != null) {
fileNum = srcFiles.length;
for (int j = 0; j < srcFiles.length; j++) {
File f = new File(ds.getBasedir(), srcFiles[j]);
filelist.append(" ").append('"').append(f.getAbsolutePath()).append('"');


+ 14
- 4
src/main/org/apache/tools/ant/util/ReflectUtil.java View File

@@ -125,18 +125,28 @@ public class ReflectUtil {
*/
public static void throwBuildException(Exception t)
throws BuildException {
throw toBuildException(t);
}

/**
* A method to convert an invocationTargetException to
* a buildexception.
* @param t the invocation target exception.
* @since ant 1.7.1
*/
public static BuildException toBuildException(Exception t) {
if (t instanceof InvocationTargetException) {
Throwable t2 = ((InvocationTargetException) t)
.getTargetException();
if (t2 instanceof BuildException) {
throw (BuildException) t2;
return (BuildException) t2;
}
throw new BuildException(t2);
return new BuildException(t2);
} else {
throw new BuildException(t);
return new BuildException(t);
}
}
/**
* A method to test if an object responds to a given
* message (method call)


+ 1
- 3
src/main/org/apache/tools/ant/util/ScriptRunnerCreator.java View File

@@ -130,10 +130,8 @@ public class ScriptRunnerCreator {
runnerClass, true, scriptLoader).newInstance();
runner.setProject(project);
} catch (Exception ex) {
ReflectUtil.throwBuildException(ex);
// NotReached
throw ReflectUtil.toBuildException(ex);
}

runner.setLanguage(language);
runner.setScriptClassLoader(scriptLoader);
return runner;


Loading…
Cancel
Save