You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by sb...@apache.org on 2002/02/01 23:46:51 UTC
cvs commit: jakarta-ant/src/main/org/apache/tools/ant Main.java
sbailliez 02/02/01 14:46:51
Modified: src/main/org/apache/tools/ant Main.java
Log:
- Try to close the file rather than relying on finalization.
Revision Changes Path
1.55 +9 -1 jakarta-ant/src/main/org/apache/tools/ant/Main.java
Index: Main.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Main.java,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- Main.java 1 Feb 2002 22:27:38 -0000 1.54
+++ Main.java 1 Feb 2002 22:46:51 -0000 1.55
@@ -351,13 +351,21 @@
propertyFileIndex++) {
String filename = (String) propertyFiles.elementAt(propertyFileIndex);
Properties props = new Properties();
+ FileInputStream fis = null;
try {
- FileInputStream fis = new FileInputStream(filename);
+ fis = new FileInputStream(filename);
props.load(fis);
}
catch (IOException e) {
System.out.println("Could not load property file "
+ filename + ": " + e.getMessage());
+ } finally {
+ if (fis != null){
+ try {
+ fis.close();
+ } catch (IOException e){
+ }
+ }
}
// ensure that -D properties take precedence
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant Main.java
Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Thanks!
----- Original Message -----
From: <sb...@apache.org>
To: <ja...@apache.org>
Sent: Friday, February 01, 2002 5:46 PM
Subject: cvs commit: jakarta-ant/src/main/org/apache/tools/ant Main.java
> sbailliez 02/02/01 14:46:51
>
> Modified: src/main/org/apache/tools/ant Main.java
> Log:
> - Try to close the file rather than relying on finalization.
>
> Revision Changes Path
> 1.55 +9 -1 jakarta-ant/src/main/org/apache/tools/ant/Main.java
>
> Index: Main.java
> ===================================================================
> RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Main.java,v
> retrieving revision 1.54
> retrieving revision 1.55
> diff -u -r1.54 -r1.55
> --- Main.java 1 Feb 2002 22:27:38 -0000 1.54
> +++ Main.java 1 Feb 2002 22:46:51 -0000 1.55
> @@ -351,13 +351,21 @@
> propertyFileIndex++) {
> String filename = (String)
propertyFiles.elementAt(propertyFileIndex);
> Properties props = new Properties();
> + FileInputStream fis = null;
> try {
> - FileInputStream fis = new FileInputStream(filename);
> + fis = new FileInputStream(filename);
> props.load(fis);
> }
> catch (IOException e) {
> System.out.println("Could not load property file "
> + filename + ": " + e.getMessage());
> + } finally {
> + if (fis != null){
> + try {
> + fis.close();
> + } catch (IOException e){
> + }
> + }
> }
>
> // ensure that -D properties take precedence
>
>
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant Main.java
Posted by Magesh Umasankar <um...@apache.org>.
From: <sb...@apache.org>
> - Try to close the file rather than relying on finalization.
One more thing... Copyright Year 2002 has not been added.
Cheers,
Magesh
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>