Browse Source

fmt; FileUtils.close(); remove unnecessary return stmt

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@559634 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 18 years ago
parent
commit
75d7415043
1 changed files with 6 additions and 8 deletions
  1. +6
    -8
      src/main/org/apache/tools/ant/taskdefs/Property.java

+ 6
- 8
src/main/org/apache/tools/ant/taskdefs/Property.java View File

@@ -37,6 +37,7 @@ import org.apache.tools.ant.PropertyHelper;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.util.FileUtils;


/** /**
* Sets a property by name, or set of properties (from file or * Sets a property by name, or set of properties (from file or
@@ -529,12 +530,12 @@ public class Property extends Task {
// load the xml based property definition // load the xml based property definition
// use reflection because of bwc to Java 1.3 // use reflection because of bwc to Java 1.3
try { try {
Method loadXmlMethod = props.getClass().getMethod("loadFromXML", new Class[]{InputStream.class});
loadXmlMethod.invoke(props, new Object[]{is});
Method loadXmlMethod = props.getClass().getMethod("loadFromXML",
new Class[] { InputStream.class });
loadXmlMethod.invoke(props, new Object[] { is });
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
e.printStackTrace(); e.printStackTrace();
log("Can not load xml based property definition on Java < 5"); log("Can not load xml based property definition on Java < 5");
return;
} catch (Exception e) { } catch (Exception e) {
// no-op // no-op
e.printStackTrace(); e.printStackTrace();
@@ -545,7 +546,6 @@ public class Property extends Task {
} }
} }



/** /**
* load properties from a file * load properties from a file
* @param file file to load * @param file file to load
@@ -561,14 +561,12 @@ public class Property extends Task {
fis = new FileInputStream(file); fis = new FileInputStream(file);
loadProperties(props, fis, file.getName().endsWith(".xml")); loadProperties(props, fis, file.getName().endsWith(".xml"));
} finally { } finally {
if (fis != null) {
fis.close();
}
FileUtils.close(fis);
} }
addProperties(props); addProperties(props);
} else { } else {
log("Unable to find property file: " + file.getAbsolutePath(), log("Unable to find property file: " + file.getAbsolutePath(),
Project.MSG_VERBOSE);
Project.MSG_VERBOSE);
} }
} catch (IOException ex) { } catch (IOException ex) {
throw new BuildException(ex, getLocation()); throw new BuildException(ex, getLocation());


Loading…
Cancel
Save