[kaffe] CVS kaffe (robilad): resynced with gnu classpath: xml fixes

Kaffe CVS cvs-commits at kaffe.org
Sun May 15 12:54:13 PDT 2005


PatchSet 6537 
Date: 2005/05/16 02:32:35
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
resynced with gnu classpath: xml fixes

2005-05-15  Dalibor Topic  <robilad at kaffe.org>

        Resynced with GNU Classpath.

        2005-05-14  Chris Burdess  <dog at gnu.org>

        * gnu/xml/dom/DomDocumentBuilder.java,
          gnu/xml/dom/transform/XSLUriResolver.java: Handle unqualified
        relative URLs.
        * gnu/xml/dom/ls/SAXEventSink.java: Ignore XML entities in start/
        end entity callbacks.

Members: 
	ChangeLog:1.4060->1.4061 
	libraries/javalib/gnu/xml/dom/DomDocumentBuilder.java:1.3->1.4 
	libraries/javalib/gnu/xml/dom/ls/SAXEventSink.java:1.4->1.5 
	libraries/javalib/gnu/xml/transform/XSLURIResolver.java:1.5->1.6 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4060 kaffe/ChangeLog:1.4061
--- kaffe/ChangeLog:1.4060	Sun May 15 18:29:20 2005
+++ kaffe/ChangeLog	Sun May 15 18:32:35 2005
@@ -2,6 +2,18 @@
 
 	Resynced with GNU Classpath.
 
+	2005-05-14  Chris Burdess  <dog at gnu.org>
+
+        * gnu/xml/dom/DomDocumentBuilder.java,
+          gnu/xml/dom/transform/XSLUriResolver.java: Handle unqualified
+        relative URLs.
+        * gnu/xml/dom/ls/SAXEventSink.java: Ignore XML entities in start/
+        end entity callbacks.
+
+2005-05-15  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+
 	2005-05-13  Roman Kennke  <roman at kennke.org>
 
         * javax/swing/plaf/basic/BasicOptionPaneUI.java
Index: kaffe/libraries/javalib/gnu/xml/dom/DomDocumentBuilder.java
diff -u kaffe/libraries/javalib/gnu/xml/dom/DomDocumentBuilder.java:1.3 kaffe/libraries/javalib/gnu/xml/dom/DomDocumentBuilder.java:1.4
--- kaffe/libraries/javalib/gnu/xml/dom/DomDocumentBuilder.java:1.3	Mon Feb 14 02:54:30 2005
+++ kaffe/libraries/javalib/gnu/xml/dom/DomDocumentBuilder.java	Sun May 15 18:32:42 2005
@@ -39,6 +39,8 @@
 
 import java.io.InputStream;
 import java.io.IOException;
+import java.io.Reader;
+import java.net.URL;
 import javax.xml.parsers.DocumentBuilder;
 import org.w3c.dom.Document;
 import org.w3c.dom.DOMConfiguration;
@@ -140,6 +142,7 @@
     throws SAXException, IOException
   {
     LSInput input = ls.createLSInput();
+    String systemId = is.getSystemId();
     InputStream in = is.getByteStream();
     if (in != null)
       {
@@ -147,10 +150,19 @@
       }
     else
       {
-        input.setCharacterStream(is.getCharacterStream());
+        Reader reader = is.getCharacterStream();
+        if (reader != null)
+          {
+            input.setCharacterStream(reader);
+          }
+        else
+          {
+            URL url = new URL(systemId);
+            input.setByteStream(url.openStream());
+          }
       }
     input.setPublicId(is.getPublicId());
-    input.setSystemId(is.getSystemId());
+    input.setSystemId(systemId);
     input.setEncoding(is.getEncoding());
     return parser.parse(input);
   }
Index: kaffe/libraries/javalib/gnu/xml/dom/ls/SAXEventSink.java
diff -u kaffe/libraries/javalib/gnu/xml/dom/ls/SAXEventSink.java:1.4 kaffe/libraries/javalib/gnu/xml/dom/ls/SAXEventSink.java:1.5
--- kaffe/libraries/javalib/gnu/xml/dom/ls/SAXEventSink.java:1.4	Fri Mar 11 20:12:32 2005
+++ kaffe/libraries/javalib/gnu/xml/dom/ls/SAXEventSink.java	Sun May 15 18:32:44 2005
@@ -366,6 +366,14 @@
         ctx = doctype;
         return;
       }
+    if ("lt".equals(name) ||
+        "gt".equals(name) ||
+        "amp".equals(name) ||
+        "apos".equals(name) ||
+        "quot".equals(name))
+      {
+        return;
+      }
     // Get entity
     NamedNodeMap entities = doctype.getEntities();
     Entity entity = (Entity) entities.getNamedItem(name);
@@ -385,6 +393,15 @@
         // Ignore DTD and parameter entities
         return;
       }
+    if ("lt".equals(name) ||
+        "gt".equals(name) ||
+        "amp".equals(name) ||
+        "apos".equals(name) ||
+        "quot".equals(name))
+      {
+        return;
+      }
+    // Get entity
     Entity entity = popEntity();
     // TODO resolve external entities to ensure that entity has content
     if (expandEntityReferences)
Index: kaffe/libraries/javalib/gnu/xml/transform/XSLURIResolver.java
diff -u kaffe/libraries/javalib/gnu/xml/transform/XSLURIResolver.java:1.5 kaffe/libraries/javalib/gnu/xml/transform/XSLURIResolver.java:1.6
--- kaffe/libraries/javalib/gnu/xml/transform/XSLURIResolver.java:1.5	Mon Feb 14 20:49:36 2005
+++ kaffe/libraries/javalib/gnu/xml/transform/XSLURIResolver.java	Sun May 15 18:32:44 2005
@@ -134,33 +134,41 @@
                   }
               }
           }
-        if (in == null && url != null)
+        if (in == null)
           {
-            systemId = url.toString();
-            node = (Node) nodeCache.get(systemId);
-            // Is the resource up to date?
-            URLConnection conn = url.openConnection();
-            Long llm = (Long) lastModifiedCache.get(systemId);
-            if (llm != null)
-              {
-                lastLastModified = llm.longValue();
-                conn.setIfModifiedSince(lastLastModified);
-              }
-            conn.connect();
-            lastModified = conn.getLastModified();
-            if (node != null && 
-                lastModified > 0L &&
-                lastModified <= lastLastModified)
+            if (url != null)
               {
-                // Resource unchanged
-                return new DOMSource(node, systemId);
+                systemId = url.toString();
+                node = (Node) nodeCache.get(systemId);
+                // Is the resource up to date?
+                URLConnection conn = url.openConnection();
+                Long llm = (Long) lastModifiedCache.get(systemId);
+                if (llm != null)
+                  {
+                    lastLastModified = llm.longValue();
+                    conn.setIfModifiedSince(lastLastModified);
+                  }
+                conn.connect();
+                lastModified = conn.getLastModified();
+                if (node != null && 
+                    lastModified > 0L &&
+                    lastModified <= lastLastModified)
+                  {
+                    // Resource unchanged
+                    return new DOMSource(node, systemId);
+                  }
+                else
+                  {
+                    // Resource new or modified
+                    in = conn.getInputStream();
+                    nodeCache.put(systemId, node);
+                    lastModifiedCache.put(systemId, new Long(lastModified));
+                  }
               }
             else
               {
-                // Resource new or modified
-                in = conn.getInputStream();
-                nodeCache.put(systemId, node);
-                lastModifiedCache.put(systemId, new Long(lastModified));
+                throw new TransformerException("can't resolve URL: " +
+                                               systemId);
               }
           }
         InputSource input = new InputSource(in);
@@ -206,6 +214,11 @@
             else if (href != null)
               {
                 url = new URL(href);
+              }
+            else
+              {
+                // See below
+                throw new MalformedURLException(systemId);
               }
           }
         return url;




More information about the kaffe mailing list