[4.1] [patch] Fix bug in xml transformer

Matthias Klose doko@cs.tu-berlin.de
Thu Dec 8 15:23:00 GMT 2005


Fix bug in xml transformer, needed to fix eclipse's handling of its
configuration files, proposed by Michael Koch.

AFAIU, this patch form classpath trunk should not be applied to the
trunk, but to to the 4.1 branch only and mentioned in
libjava/classpath/ChangeLog.gcj.

Ok to apply?

  Matthias


2005-11-20  Chris Burdess  <dog@gnu.org>

        * gnu/xml/transform/TransformerImpl.java: Ensure that output stream
        is not closed if provided in the StreamResult.

Index: gnu/xml/transform/TransformerImpl.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/xml/transform/TransformerImpl.java,v
retrieving revision 1.6
diff -u -r1.6 TransformerImpl.java
--- libjava/classpath/gnu/xml/transform/TransformerImpl.java      30 Sep 2005 07:17:04 -0000      1.6
+++ libjava/classpath/gnu/xml/transform/TransformerImpl.java      20 Nov 2005 12:02:48 -0000
@@ -487,6 +487,7 @@
     throws IOException
   {
     OutputStream out = null;
+    boolean created = false;
     try
       {
         out = sr.getOutputStream();
@@ -523,6 +524,7 @@
                 URL url = new URL(systemId);
                 out = new FileOutputStream(url.getPath());
               }
+            created = true;
           }
         out = new BufferedOutputStream(out);
         StreamSerializer serializer =
@@ -539,7 +541,7 @@
       {
         try
           {
-            if (out != null)
+            if (out != null && created)
               {
                 out.close();
               }



More information about the Java-patches mailing list