[kaffe] CVS kaffe (robilad): Resynced with GNU JAXP: fixes for stream/reader wrapping

Kaffe CVS cvs-commits at kaffe.org
Mon Dec 6 01:10:58 PST 2004


PatchSet 5546 
Date: 2004/12/06 09:02:42
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU JAXP: fixes for stream/reader wrapping

2004-12-06  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/gnu/xml/dom/ls/ReaderInputStream.java,
        libraries/javalib/gnu/xml/dom/ls/WriterOutputStream.java,
        libraries/javalib/gnu/xml/libxmlj/transform/GnomeTransformer.java,
        libraries/javalib/gnu/xml/libxmlj/util/XMLJ.java:
        Resynced with GNU JAXP.

        2004-12-06  Mark Wielaard  <mark at klomp.org>
        Fixes for Reader & InputStream wrapping.

Members: 
	ChangeLog:1.3092->1.3093 
	libraries/javalib/gnu/xml/dom/ls/ReaderInputStream.java:1.2->1.3 
	libraries/javalib/gnu/xml/dom/ls/WriterOutputStream.java:1.1->1.2 
	libraries/javalib/gnu/xml/libxmlj/transform/GnomeTransformer.java:1.8->1.9 
	libraries/javalib/gnu/xml/libxmlj/util/XMLJ.java:1.7->1.8 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3092 kaffe/ChangeLog:1.3093
--- kaffe/ChangeLog:1.3092	Mon Dec  6 08:27:42 2004
+++ kaffe/ChangeLog	Mon Dec  6 09:02:42 2004
@@ -1,3 +1,14 @@
+2004-12-06  Dalibor Topic  <robilad at kaffe.org>
+
+	* libraries/javalib/gnu/xml/dom/ls/ReaderInputStream.java,
+	libraries/javalib/gnu/xml/dom/ls/WriterOutputStream.java,
+	libraries/javalib/gnu/xml/libxmlj/transform/GnomeTransformer.java,
+	libraries/javalib/gnu/xml/libxmlj/util/XMLJ.java:
+	Resynced with GNU JAXP.
+
+	2004-12-06  Mark Wielaard  <mark at klomp.org>
+	Fixes for Reader & InputStream wrapping.
+
 2004-12-05  Davanum Srinivas  <davanum at gmail.com>
 
 	* libraries/javalib/gnu/java/net/protocol/http/HTTPURLConnection.java:
Index: kaffe/libraries/javalib/gnu/xml/dom/ls/ReaderInputStream.java
diff -u kaffe/libraries/javalib/gnu/xml/dom/ls/ReaderInputStream.java:1.2 kaffe/libraries/javalib/gnu/xml/dom/ls/ReaderInputStream.java:1.3
--- kaffe/libraries/javalib/gnu/xml/dom/ls/ReaderInputStream.java:1.2	Sun Dec  5 18:56:53 2004
+++ kaffe/libraries/javalib/gnu/xml/dom/ls/ReaderInputStream.java	Mon Dec  6 09:02:52 2004
@@ -47,17 +47,17 @@
  *
  * @author <a href='mailto:dog at gnu.org'>Chris Burdess</a>
  */
-class ReaderInputStream
+public class ReaderInputStream
   extends InputStream
 {
 
   private Reader reader;
   private String encoding;
 
-  ReaderInputStream(Reader reader)
+  public ReaderInputStream(Reader reader)
   {
     this.reader = reader;
-    this.encoding = "UTF-8";
+    encoding = "UTF-8";
   }
 
   void setEncoding(String encoding)
Index: kaffe/libraries/javalib/gnu/xml/dom/ls/WriterOutputStream.java
diff -u kaffe/libraries/javalib/gnu/xml/dom/ls/WriterOutputStream.java:1.1 kaffe/libraries/javalib/gnu/xml/dom/ls/WriterOutputStream.java:1.2
--- kaffe/libraries/javalib/gnu/xml/dom/ls/WriterOutputStream.java:1.1	Sat Dec  4 21:12:26 2004
+++ kaffe/libraries/javalib/gnu/xml/dom/ls/WriterOutputStream.java	Mon Dec  6 09:02:52 2004
@@ -47,17 +47,17 @@
  *
  * @author <a href='mailto:dog at gnu.org'>Chris Burdess</a>
  */
-class WriterOutputStream
+public class WriterOutputStream
   extends OutputStream
 {
 
   private Writer writer;
   private String encoding;
 
-  WriterOutputStream(Writer writer)
+  public WriterOutputStream(Writer writer)
   {
     this.writer = writer;
-    this.encoding = "UTF16";
+    this.encoding = "UTF-8";
   }
 
   void setEncoding(String encoding)
Index: kaffe/libraries/javalib/gnu/xml/libxmlj/transform/GnomeTransformer.java
diff -u kaffe/libraries/javalib/gnu/xml/libxmlj/transform/GnomeTransformer.java:1.8 kaffe/libraries/javalib/gnu/xml/libxmlj/transform/GnomeTransformer.java:1.9
--- kaffe/libraries/javalib/gnu/xml/libxmlj/transform/GnomeTransformer.java:1.8	Sat Dec  4 21:12:27 2004
+++ kaffe/libraries/javalib/gnu/xml/libxmlj/transform/GnomeTransformer.java	Mon Dec  6 09:02:52 2004
@@ -1,5 +1,5 @@
 /* 
- * $Id: GnomeTransformer.java,v 1.8 2004/12/04 21:12:27 robilad Exp $
+ * $Id: GnomeTransformer.java,v 1.9 2004/12/06 09:02:52 robilad Exp $
  * Copyright (C) 2003, 2004 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Classpathx/jaxp.
@@ -141,7 +141,7 @@
       {
         stylesheet = newStylesheet ();
       } 
-    if (source instanceof StreamSource)
+    else if (source instanceof StreamSource)
       {
         try
           {
@@ -180,7 +180,7 @@
       }
     else
       {
-        String msg = "Source type not supported";
+        String msg = "Source type not supported (" + source + ")";
         throw new TransformerConfigurationException (msg);
       }
   }
@@ -344,7 +344,7 @@
               }
             else
               {
-                String msg = "Result type not supported";
+                String msg = "Result type not supported (" + result + ")";
                 throw new TransformerConfigurationException (msg);
               }
           }
@@ -359,7 +359,7 @@
         Node node = ds.getNode ();
         if (!(node instanceof GnomeDocument))
           {
-            String msg = "Node is not a GnomeDocument";
+            String msg = "Node is not a GnomeDocument (" + node + ")";
             throw new TransformerException (msg);
           }
         GnomeDocument doc = (GnomeDocument) node;
Index: kaffe/libraries/javalib/gnu/xml/libxmlj/util/XMLJ.java
diff -u kaffe/libraries/javalib/gnu/xml/libxmlj/util/XMLJ.java:1.7 kaffe/libraries/javalib/gnu/xml/libxmlj/util/XMLJ.java:1.8
--- kaffe/libraries/javalib/gnu/xml/libxmlj/util/XMLJ.java:1.7	Sat Dec  4 21:12:28 2004
+++ kaffe/libraries/javalib/gnu/xml/libxmlj/util/XMLJ.java	Mon Dec  6 09:02:52 2004
@@ -43,6 +43,8 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PushbackInputStream;
+import java.io.Reader;
+import java.io.Writer;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLConnection;
@@ -57,6 +59,9 @@
 
 import gnu.xml.libxmlj.transform.GnomeTransformerFactory;
 
+import gnu.xml.dom.ls.ReaderInputStream;
+import gnu.xml.dom.ls.WriterOutputStream;
+
 /**
  * Utility functions for libxmlj.
  */
@@ -107,6 +112,12 @@
     String systemId = input.getSystemId ();
     if (in == null)
       {
+       Reader r = input.getCharacterStream();
+       if (r != null)
+         in = new ReaderInputStream(r);
+      }
+    if (in == null)
+      {
         in = getInputStream(systemId);
       }
     return new NamedInputStream (systemId, in, LOOKAHEAD);
@@ -199,6 +210,12 @@
       }
     if (out == null)
       {
+       Writer w = ((StreamResult) result).getWriter ();
+       if (w != null)
+         out = new WriterOutputStream (w);
+      }
+    if (out == null)
+      {
         String systemId = result.getSystemId ();
         if (systemId == null)
           {
@@ -216,6 +233,7 @@
             out = new FileOutputStream (systemId);
           }
       }
+
     return out;
   }
 




More information about the kaffe mailing list