bodewig 02/04/12 06:53:27
Modified: src/main/org/apache/tools/ant/taskdefs Definer.java
Log:
<taskdef>/<typedef> wouldn't close their streams if file/resource
attribute has been used and an exception occured.
Revision Changes Path
1.13 +15 -4
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Definer.java
Index: Definer.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Definer.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Definer.java 12 Apr 2002 13:44:35 -0000 1.12
+++ Definer.java 12 Apr 2002 13:53:27 -0000 1.13
@@ -74,6 +74,8 @@
*
* @author Costin Manolache
* @author <a href="[EMAIL PROTECTED]">Stefan Bodewig</a>
+ *
+ * @since Ant 1.4
*/
public abstract class Definer extends Task {
private String name;
@@ -85,7 +87,8 @@
public void setReverseLoader(boolean reverseLoader) {
this.reverseLoader = reverseLoader;
- log("The reverseloader attribute is DEPRECATED. It will be removed",
Project.MSG_WARN);
+ log("The reverseloader attribute is DEPRECATED. It will be removed",
+ Project.MSG_WARN);
}
public void setClasspath(Path classpath) {
@@ -123,6 +126,7 @@
} else {
+ InputStream is=null;
try {
if (name != null || value != null) {
String msg = "You must not specify name or value "
@@ -131,13 +135,13 @@
}
if (file != null && resource != null) {
- String msg = "You must not specify both, file and
resource.";
+ String msg = "You must not specify both, file and "
+ + "resource.";
throw new BuildException(msg, location);
}
Properties props=new Properties();
- InputStream is=null;
if( file != null ) {
log("Loading definitions from file " + file,
Project.MSG_VERBOSE);
@@ -169,6 +173,12 @@
}
} catch( IOException ex ) {
throw new BuildException(ex, location);
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {}
+ }
}
}
}
@@ -196,7 +206,8 @@
if (classpath != null) {
al = new AntClassLoader(project, classpath, !reverseLoader);
} else {
- al = new AntClassLoader(project, Path.systemClasspath,
!reverseLoader);
+ al = new AntClassLoader(project, Path.systemClasspath,
+ !reverseLoader);
}
// need to load Task via system classloader or the new
// task we want to define will never be a Task but always
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>