[kaffe] CVS kaffe (dalibor): Resynced with GNU JAXP

Kaffe CVS Kaffe Mailing List <kaffe@kaffe.org>
Thu Nov 13 04:54:03 2003


PatchSet 4163 
Date: 2003/11/13 12:48:20
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU JAXP

As they don't maintaine a ChangeLog, I didn't bother to sum up
the changes with more detail.

Members: 
	ChangeLog:1.1755->1.1756 
	libraries/javalib/gnu/xml/pipeline/XIncludeFilter.java:1.2->1.3 
	libraries/javalib/org/xml/sax/ext/Attributes2.java:1.1->1.2 
	libraries/javalib/org/xml/sax/ext/Attributes2Impl.java:1.1->1.2 
	libraries/javalib/org/xml/sax/helpers/XMLReaderFactory.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1755 kaffe/ChangeLog:1.1756
--- kaffe/ChangeLog:1.1755	Thu Nov 13 00:28:01 2003
+++ kaffe/ChangeLog	Thu Nov 13 12:48:20 2003
@@ -1,5 +1,13 @@
 2003-11-13  Dalibor Topic <robilad@kaffe.org>
 
+	* libraries/javalib/gnu/xml/pipeline/XIncludeFilter.java,
+	libraries/javalib/org/xml/sax/ext/Attributes2.java,
+	libraries/javalib/org/xml/sax/ext/Attributes2Impl.java,
+	libraries/javalib/org/xml/sax/helpers/XMLReaderFactory.java:
+	Resynced with GNU JAXP.
+
+2003-11-13  Dalibor Topic <robilad@kaffe.org>
+
 	* libraries/javalib/gnu/java/net/protocol/file/Connection.java:
 	Added imports for java.io.FilePermission and 
 	java.security.Permission.
@@ -12,7 +20,7 @@
 
 2003-11-12 Ito Kazumitsu <kaz@maczuka.gcd.org>
 
-	libraries/javalib/profiles/allatonce/all.files,
+	* libraries/javalib/profiles/allatonce/all.files,
 	libraries/javalib/profiles/default/core.files,
 	libraries/javalib/Makefile.am,
 	libraries/javalib/Makefile.in:
@@ -20,12 +28,12 @@
 
 2003-11-12 Ito Kazumitsu <kaz@maczuka.gcd.org>
 
-	kaffe/kaffevm/acces.c:
+	* kaffe/kaffevm/acces.c:
 	(checkAccess) corrected to avoid java.lang.IllegalAccessError.
 
 2003-11-12 Ito Kazumitsu <kaz@maczuka.gcd.org>
 
-	libraries/javalib/kaffe/io/ByteToCharSHIFT_JIS.java,
+	* libraries/javalib/kaffe/io/ByteToCharSHIFT_JIS.java,
 	libraries/javalib/kaffe/io/ChartoByteSHIFT_JIS.java:
 	New Files.
 
@@ -47,7 +55,7 @@
 
 2003-11-06 Ito Kazumitsu <kaz@maczuka.gcd.org>
 
-	libraries/javalib/gnu/xml/aelfred2/SAXDriver.java,
+	* libraries/javalib/gnu/xml/aelfred2/SAXDriver.java,
 	libraries/javalib/gnu/xml/aelfred2/XmlParser.java:
 	Resynced with GNU Classpathx.
 
Index: kaffe/libraries/javalib/gnu/xml/pipeline/XIncludeFilter.java
diff -u kaffe/libraries/javalib/gnu/xml/pipeline/XIncludeFilter.java:1.2 kaffe/libraries/javalib/gnu/xml/pipeline/XIncludeFilter.java:1.3
--- kaffe/libraries/javalib/gnu/xml/pipeline/XIncludeFilter.java:1.2	Thu Feb  6 21:35:08 2003
+++ kaffe/libraries/javalib/gnu/xml/pipeline/XIncludeFilter.java	Thu Nov 13 12:48:22 2003
@@ -1,5 +1,5 @@
 /*
- * $Id: XIncludeFilter.java,v 1.2 2003/02/06 21:35:08 dalibor Exp $
+ * $Id: XIncludeFilter.java,v 1.3 2003/11/13 12:48:22 dalibor Exp $
  * Copyright (C) 2001-2002 David Brownell
  * 
  * This file is part of GNU JAXP, a library.
@@ -50,7 +50,7 @@
 
 
 
-// $Id: XIncludeFilter.java,v 1.2 2003/02/06 21:35:08 dalibor Exp $
+// $Id: XIncludeFilter.java,v 1.3 2003/11/13 12:48:22 dalibor Exp $
 
 /**
  * Filter to process an XPointer-free subset of
@@ -91,7 +91,7 @@
  * <p>TBD: "IURI" handling.
  *
  * @author David Brownell
- * @version $Date: 2003/02/06 21:35:08 $
+ * @version $Date: 2003/11/13 12:48:22 $
  */
 public class XIncludeFilter extends EventFilter implements Locator
 {
@@ -457,12 +457,12 @@
 	    super (f);
 
 	    // process all content events
-	    setContentHandler (this);
-	    setProperty (LEXICAL_HANDLER, this);
+	    super.setContentHandler (this);
+	    super.setProperty (LEXICAL_HANDLER, this);
 
 	    // drop all DTD events
-	    setDTDHandler (null);
-	    setProperty (DECL_HANDLER, null);
+	    super.setDTDHandler (null);
+	    super.setProperty (DECL_HANDLER, null);
 	}
 
 	// maintain proxy locator
Index: kaffe/libraries/javalib/org/xml/sax/ext/Attributes2.java
diff -u kaffe/libraries/javalib/org/xml/sax/ext/Attributes2.java:1.1 kaffe/libraries/javalib/org/xml/sax/ext/Attributes2.java:1.2
--- kaffe/libraries/javalib/org/xml/sax/ext/Attributes2.java:1.1	Mon Dec  2 15:04:14 2002
+++ kaffe/libraries/javalib/org/xml/sax/ext/Attributes2.java	Thu Nov 13 12:48:23 2003
@@ -1,7 +1,7 @@
 // Attributes2.java - extended Attributes
 // http://www.saxproject.org
 // Public Domain: no warranty.
-// $Id: Attributes2.java,v 1.1 2002/12/02 15:04:14 dalibor Exp $
+// $Id: Attributes2.java,v 1.2 2003/11/13 12:48:23 dalibor Exp $
 
 package org.xml.sax.ext;
 
@@ -31,6 +31,27 @@
  */
 public interface Attributes2 extends Attributes
 {
+
+
+    /** @return false unless the attribute was declared in the DTD.
+     * @throws java.lang.ArrayIndexOutOfBoundsException
+     *   When the supplied index does not identify an attribute.
+     */    
+    public boolean isDeclared (int index);
+
+    /** @return false unless the attribute was declared in the DTD.
+     * @throws java.lang.IllegalArgumentException
+     *   When the supplied names do not identify an attribute.
+     */
+    public boolean isDeclared (java.lang.String qName);
+
+    /** @return false unless the attribute was declared in the DTD.
+     * @throws java.lang.IllegalArgumentException
+     *   When the supplied names do not identify an attribute.
+     */
+    public boolean isDeclared (java.lang.String uri, java.lang.String localName);
+
+    
     /**
      * Returns true unless the attribute value was provided
      * by DTD defaulting.
Index: kaffe/libraries/javalib/org/xml/sax/ext/Attributes2Impl.java
diff -u kaffe/libraries/javalib/org/xml/sax/ext/Attributes2Impl.java:1.1 kaffe/libraries/javalib/org/xml/sax/ext/Attributes2Impl.java:1.2
--- kaffe/libraries/javalib/org/xml/sax/ext/Attributes2Impl.java:1.1	Mon Dec  2 15:04:14 2002
+++ kaffe/libraries/javalib/org/xml/sax/ext/Attributes2Impl.java	Thu Nov 13 12:48:23 2003
@@ -1,7 +1,7 @@
 // Attributes2Impl.java - extended AttributesImpl
 // http://www.saxproject.org
 // Public Domain: no warranty.
-// $Id: Attributes2Impl.java,v 1.1 2002/12/02 15:04:14 dalibor Exp $
+// $Id: Attributes2Impl.java,v 1.2 2003/11/13 12:48:23 dalibor Exp $
 
 package org.xml.sax.ext;
 
@@ -32,6 +32,7 @@
 {
     private boolean	flags [];
 
+    private boolean     declaredFlags[];
 
     /**
      * Construct a new, empty Attributes2Impl object.
@@ -61,6 +62,52 @@
     ////////////////////////////////////////////////////////////////////
 
 
+
+    /*
+      note(1)
+      The implementation of the isDeclared methods is wrong. It's only here
+      to make the class compile, it's not intended to work yet.
+    */
+
+
+    /** @return false unless the attribute was declared in the DTD.
+     * @throws java.lang.ArrayIndexOutOfBoundsException
+     *   When the supplied index does not identify an attribute.
+     */    
+    public boolean isDeclared (int index)
+    {
+	if (index < 0 || index >= getLength ())
+	    throw new ArrayIndexOutOfBoundsException ("No attribute at index: " + index);
+	return declaredFlags [index];
+    }
+
+    /** @return false unless the attribute was declared in the DTD.
+     * @throws java.lang.IllegalArgumentException
+     *   When the supplied names do not identify an attribute.
+     */
+    public boolean isDeclared (java.lang.String qName)
+    {
+	int index = getIndex (qName);
+	if (index < 0)
+	    throw new IllegalArgumentException ("No such attribute: " + qName);
+	return declaredFlags [index];
+    }
+
+    /** @return false unless the attribute was declared in the DTD.
+     * @throws java.lang.IllegalArgumentException
+     *   When the supplied names do not identify an attribute.
+     */
+    public boolean isDeclared (java.lang.String uri, java.lang.String localName)
+    {
+	int index = getIndex (uri, localName);
+	if (index < 0)
+	    throw new IllegalArgumentException ("No such attribute: local="
+						+ localName
+						+ ", namespace=" + uri);
+	return declaredFlags [index];
+    }
+
+
     /**
      * Returns the current value of an attribute's "specified" flag.
      *
@@ -137,14 +184,19 @@
 
 	super.setAttributes (atts);
 	flags = new boolean [length];
+	declaredFlags = new boolean[length];
 
 	if (atts instanceof Attributes2) {
 	    Attributes2	a2 = (Attributes2) atts;
-	    for (int i = 0; i < length; i++)
+	    for (int i = 0; i < length; i++) {
 		flags [i] = a2.isSpecified (i);
+		declaredFlags[i] = a2.isDeclared(i);
+	    }
 	} else {
-	    for (int i = 0; i < length; i++)
+	    for (int i = 0; i < length; i++) {
 		flags [i] = true;
+		declaredFlags[i] = getType(i).equals("CDATA");
+	    }
 	}
 
     }
@@ -168,9 +220,13 @@
 	    boolean	newFlags [] = new boolean [length];
 	    System.arraycopy (flags, 0, newFlags, 0, flags.length);
 	    flags = newFlags;
+	    boolean     newDeclFlags[] = new boolean[length];
+	    System.arraycopy (declaredFlags, 0, newDeclFlags, 0, declaredFlags.length);
+	    declaredFlags = newDeclFlags;
 	}
 
 	flags [length - 1] = true;
+	declaredFlags[length - 1] = type.equals("CDATA");
     }
 
 
@@ -186,6 +242,23 @@
     }
 
 
+
+    /**
+     * Assign a value to the "declared" flag of a specific attribute.
+     * This is the only way this flag can be cleared, except clearing
+     * by initialization with the copy constructor.
+     *
+     * @param index The index of the attribute (zero-based).
+     * @param value The desired flag value.
+     * @throws java.lang.ArrayIndexOutOfBoundsException
+     *    When the supplied index does not identify an attribute.
+     */
+    public void setDeclared (int index, boolean value)
+    {
+	if (index < 0 || index >= getLength ())
+	    throw new ArrayIndexOutOfBoundsException ("No attribute at index: " + index);
+	declaredFlags [index] = value;
+    }
 
     /**
      * Assign a value to the "specified" flag of a specific attribute.
Index: kaffe/libraries/javalib/org/xml/sax/helpers/XMLReaderFactory.java
diff -u kaffe/libraries/javalib/org/xml/sax/helpers/XMLReaderFactory.java:1.1 kaffe/libraries/javalib/org/xml/sax/helpers/XMLReaderFactory.java:1.2
--- kaffe/libraries/javalib/org/xml/sax/helpers/XMLReaderFactory.java:1.1	Mon Dec  2 15:04:27 2002
+++ kaffe/libraries/javalib/org/xml/sax/helpers/XMLReaderFactory.java	Thu Nov 13 12:48:23 2003
@@ -3,7 +3,7 @@
 // Written by David Megginson
 // and by David Brownell
 // NO WARRANTY!  This class is in the Public Domain.
-// $Id: XMLReaderFactory.java,v 1.1 2002/12/02 15:04:27 dalibor Exp $
+// $Id: XMLReaderFactory.java,v 1.2 2003/11/13 12:48:23 dalibor Exp $
 
 package org.xml.sax.helpers;
 import java.io.BufferedReader;
@@ -109,7 +109,7 @@
 	
 	// 1. try the JVM-instance-wide system property
 	try { className = System.getProperty (property); }
-	catch (Exception e) { /* normally fails for applets */ }
+	catch (RuntimeException e) { /* normally fails for applets */ }
 
 	// 2. if that fails, try META-INF/services/
 	if (className == null) {