Oops, right you are, changed it to be that way... Thanks,
Tom -----Original Message----- From: Michael A. Smith [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 16, 2002 10:12 AM To: Turbine Maven Developers List Subject: Re: cvs commit: jakarta-turbine-maven/src/java/org/apache/maven PackageProjectMap.java On 16 May 2002 [EMAIL PROTECTED] wrote: > tcopeland 02/05/16 08:03:19 > > Modified: src/java/org/apache/maven PackageProjectMap.java > Log: > Modified to close the FileOutputStream in a finally block. Looks > clunky, but it should save a file handle if an exception gets thrown.... [snip] > + FileOutputStream fos = null; > + try { > + fos = new FileOutputStream(map); > + m.store(fos,"Package -> Project Map"); > + } finally { > + fos.close(); > + } this should probably be: } finally { if(fos != null) { fos.close(); } } > } > } if new FileOutputStream(map) throws an exception (e.g. random IO error), you'll end up with a NullPointerException, which may be worse than a lost file descriptor. regards, michael -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
