Code changed. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@526542 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -182,8 +182,7 @@ public class Manifest { | |||||
| String lhsKey = getKey(); | String lhsKey = getKey(); | ||||
| String rhsKey = rhsAttribute.getKey(); | String rhsKey = rhsAttribute.getKey(); | ||||
| if ((lhsKey == null && rhsKey != null) | if ((lhsKey == null && rhsKey != null) | ||||
| || (lhsKey != null && rhsKey == null) | |||||
| || !lhsKey.equals(rhsKey)) { | |||||
| || (lhsKey != null && !lhsKey.equals(rhsKey))) { | |||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -452,8 +452,9 @@ public class Property extends Task { | |||||
| log("Loading " + file.getAbsolutePath(), Project.MSG_VERBOSE); | log("Loading " + file.getAbsolutePath(), Project.MSG_VERBOSE); | ||||
| try { | try { | ||||
| if (file.exists()) { | if (file.exists()) { | ||||
| FileInputStream fis = new FileInputStream(file); | |||||
| FileInputStream fis = null; | |||||
| try { | try { | ||||
| fis = new FileInputStream(file); | |||||
| props.load(fis); | props.load(fis); | ||||
| } finally { | } finally { | ||||
| if (fis != null) { | if (fis != null) { | ||||
| @@ -134,9 +134,9 @@ public class P4Fstat extends P4Base { | |||||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | ||||
| String[] srcFiles = ds.getIncludedFiles(); | String[] srcFiles = ds.getIncludedFiles(); | ||||
| fileNum = srcFiles.length; | |||||
| if (srcFiles != null) { | if (srcFiles != null) { | ||||
| fileNum = srcFiles.length; | |||||
| for (int j = 0; j < srcFiles.length; j++) { | for (int j = 0; j < srcFiles.length; j++) { | ||||
| File f = new File(ds.getBasedir(), srcFiles[j]); | File f = new File(ds.getBasedir(), srcFiles[j]); | ||||
| filelist.append(" ").append('"').append(f.getAbsolutePath()).append('"'); | filelist.append(" ").append('"').append(f.getAbsolutePath()).append('"'); | ||||
| @@ -125,18 +125,28 @@ public class ReflectUtil { | |||||
| */ | */ | ||||
| public static void throwBuildException(Exception t) | public static void throwBuildException(Exception t) | ||||
| throws BuildException { | 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) { | if (t instanceof InvocationTargetException) { | ||||
| Throwable t2 = ((InvocationTargetException) t) | Throwable t2 = ((InvocationTargetException) t) | ||||
| .getTargetException(); | .getTargetException(); | ||||
| if (t2 instanceof BuildException) { | if (t2 instanceof BuildException) { | ||||
| throw (BuildException) t2; | |||||
| return (BuildException) t2; | |||||
| } | } | ||||
| throw new BuildException(t2); | |||||
| return new BuildException(t2); | |||||
| } else { | } else { | ||||
| throw new BuildException(t); | |||||
| return new BuildException(t); | |||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * A method to test if an object responds to a given | * A method to test if an object responds to a given | ||||
| * message (method call) | * message (method call) | ||||
| @@ -130,10 +130,8 @@ public class ScriptRunnerCreator { | |||||
| runnerClass, true, scriptLoader).newInstance(); | runnerClass, true, scriptLoader).newInstance(); | ||||
| runner.setProject(project); | runner.setProject(project); | ||||
| } catch (Exception ex) { | } catch (Exception ex) { | ||||
| ReflectUtil.throwBuildException(ex); | |||||
| // NotReached | |||||
| throw ReflectUtil.toBuildException(ex); | |||||
| } | } | ||||
| runner.setLanguage(language); | runner.setLanguage(language); | ||||
| runner.setScriptClassLoader(scriptLoader); | runner.setScriptClassLoader(scriptLoader); | ||||
| return runner; | return runner; | ||||