bodewig 02/04/12 02:01:36
Modified: src/main/org/apache/tools/ant/taskdefs KeySubst.java
ProcessDestroyer.java
Log:
<keysubst> didn't close its streams. I know, this task is so
deprecated we don't even document it, but ...
Revision Changes Path
1.12 +21 -10
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/KeySubst.java
Index: KeySubst.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/KeySubst.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- KeySubst.java 25 Feb 2002 17:38:14 -0000 1.11
+++ KeySubst.java 12 Apr 2002 09:01:35 -0000 1.12
@@ -72,8 +72,9 @@
* setKeys method to understand how to do the substitutions.
*
* @author Jon S. Stevens <a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>
- *
- * @deprecated KeySubst is deprecated. Use Filter + CopyDir instead.
+ * @since Ant 1.1
+ * @deprecated KeySubst is deprecated since Ant 1.1. Use Filter + Copy
+ * instead.
*/
public class KeySubst extends Task {
private File source = null;
@@ -85,7 +86,7 @@
Do the execution.
*/
public void execute() throws BuildException {
- log("!! KeySubst is deprecated. Use Filter + CopyDir instead. !!");
+ log("!! KeySubst is deprecated. Use Filter + Copy instead. !!");
log("Performing Substitions");
if ( source == null || dest == null ) {
log("Source and destinations must not be null");
@@ -112,12 +113,22 @@
line = br.readLine();
}
bw.flush();
- bw.close();
- br.close();
} catch (IOException ioe) {
ioe.printStackTrace();
- }
+ } finally {
+ if (bw != null) {
+ try {
+ bw.close();
+ } catch (IOException e) {}
+ }
+ if (bw != null) {
+ try {
+ br.close();
+ } catch (IOException e) {}
+ }
+ }
}
+
/**
Set the source file.
*/
@@ -162,8 +173,6 @@
String name = itok.nextToken();
String value = itok.nextToken();
-// log ( "Name: " + name );
-// log ( "Value: " + value );
replacements.put ( name, value );
}
}
@@ -176,7 +185,8 @@
Hashtable hash = new Hashtable();
hash.put ( "VERSION", "1.0.3" );
hash.put ( "b", "ffff" );
- System.out.println ( KeySubst.replace ( "$f ${VERSION} f ${b} jj $",
hash ) );
+ System.out.println ( KeySubst.replace ( "$f ${VERSION} f ${b} jj $",
+ hash ) );
}catch ( Exception e)
{
e.printStackTrace();
@@ -196,7 +206,8 @@
int i = 0;
String key = null;
while ((index = origString.indexOf("${", i)) > -1) {
- key = origString.substring(index + 2, origString.indexOf("}",
index+3));
+ key = origString.substring(index + 2, origString.indexOf("}",
+
index+3));
finalString.append (origString.substring(i, index));
if ( keys.containsKey ( key ) ) {
finalString.append (keys.get(key));
1.2 +2 -1
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java
Index: ProcessDestroyer.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ProcessDestroyer.java 11 Dec 2001 14:05:43 -0000 1.1
+++ ProcessDestroyer.java 12 Apr 2002 09:01:35 -0000 1.2
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -62,6 +62,7 @@
* Destroys all registered <code>Process</code>es when the VM exits.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Michael Newcomb</a>
+ * @since Ant 1.5
*/
class ProcessDestroyer
extends Thread
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>