This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[4.1] [patch] Fix bug in xml transformer


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();
               }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]