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]>