[prev in list] [next in list] [prev in thread] [next in thread]
List: xalan-cvs
Subject: cvs commit: xml-xalan/java/src/org/apache/xalan/lib PipeDocument.java
From: minchau () apache ! org
Date: 2003-10-24 15:59:46
[Download RAW message or body]
minchau 2003/10/24 08:59:46
Modified: java/src/org/apache/xalan/lib PipeDocument.java
Log:
PipeDocument was not calling out.close() when done with the
FileOutputStream "out".
PR: bug 24013
Submitted by: Pierre Chardin (bug reporter)
Reviewed by: Brian Minchau
Revision Changes Path
1.7 +14 -4 xml-xalan/java/src/org/apache/xalan/lib/PipeDocument.java
Index: PipeDocument.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/PipeDocument.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PipeDocument.java 22 Oct 2003 17:35:36 -0000 1.6
+++ PipeDocument.java 24 Oct 2003 15:59:46 -0000 1.7
@@ -251,10 +251,20 @@
Transformer trans = tHLast.getTransformer();
Properties outputProps = trans.getOutputProperties();
Serializer serializer = SerializerFactory.getSerializer(outputProps);
- serializer.setOutputStream(new FileOutputStream(target));
- tHLast.setResult(new SAXResult(serializer.asContentHandler()));
- reader.parse(source);
+ FileOutputStream out = new FileOutputStream(target);
+ try
+ {
+ serializer.setOutputStream(out);
+ tHLast.setResult(new SAXResult(serializer.asContentHandler()));
+ reader.parse(source);
+ }
+ finally
+ {
+ // Always clean up the FileOutputStream,
+ // even if an exception was thrown in the try block
+ if (out != null)
+ out.close();
+ }
}
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic