[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: SAX fix

Kaffe CVS cvs-commits at kaffe.org
Sat Feb 5 13:16:50 PST 2005


PatchSet 5982 
Date: 2005/02/05 20:59:51
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: SAX fix

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

        Resynced with GNU Classpath.

        2005-02-04  Chris Burdess  <dog at gnu.org>

        * gnu/xml/aelfred2/SAXDriver.java: Corrected implementation of
        isDeclared methods. Improved performance of isSpecified methods.

Members: 
	ChangeLog:1.3520->1.3521 
	libraries/javalib/gnu/xml/aelfred2/SAXDriver.java:1.15->1.16 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3520 kaffe/ChangeLog:1.3521
--- kaffe/ChangeLog:1.3520	Sat Feb  5 20:53:54 2005
+++ kaffe/ChangeLog	Sat Feb  5 20:59:51 2005
@@ -2,6 +2,15 @@
 
 	Resynced with GNU Classpath.
 
+	2005-02-04  Chris Burdess  <dog at gnu.org>
+
+        * gnu/xml/aelfred2/SAXDriver.java: Corrected implementation of
+        isDeclared methods. Improved performance of isSpecified methods.
+
+2005-02-05  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+
 	2005-02-04  Michael Koch  <konqueror at gmx.de>
 
         * javax/swing/SortingFocusTraversalPolicy.java
Index: kaffe/libraries/javalib/gnu/xml/aelfred2/SAXDriver.java
diff -u kaffe/libraries/javalib/gnu/xml/aelfred2/SAXDriver.java:1.15 kaffe/libraries/javalib/gnu/xml/aelfred2/SAXDriver.java:1.16
--- kaffe/libraries/javalib/gnu/xml/aelfred2/SAXDriver.java:1.15	Wed Jan  5 17:11:39 2005
+++ kaffe/libraries/javalib/gnu/xml/aelfred2/SAXDriver.java	Sat Feb  5 20:59:57 2005
@@ -150,10 +150,7 @@
     private Stack			entityStack;
 
     // one vector (of object/struct): faster, smaller
-    private List			attributesList = Collections.synchronizedList(new ArrayList());
-  
-    private boolean			attributeSpecified [] = new boolean[10];
-    private boolean			attributeDeclared [] = new boolean[10];
+    private List			attributesList;
 
     private boolean			namespaces = true;
     private boolean			xmlNames = false;
@@ -183,8 +180,6 @@
       elementName = null;
       entityStack = new Stack ();
       attributesList = Collections.synchronizedList(new ArrayList());
-      attributeSpecified = new boolean[10];
-      attributeDeclared = new boolean[10];
       attributeCount = 0;
       attributes = false;
       nsTemp = new String[3];
@@ -849,17 +844,10 @@
   }
 	// remember this attribute ...
 
-	if (attributeCount == attributeSpecified.length) { 	// grow array?
-	    boolean temp [] = new boolean [attributeSpecified.length + 5];
-	    System.arraycopy (attributeSpecified, 0, temp, 0, attributeCount);
-	    attributeSpecified = temp;
-	}
-	attributeSpecified [attributeCount] = isSpecified;
-
 	attributeCount++;
 	
 	// attribute type comes from querying parser's DTD records
-	attributesList.add(new Attribute(qname, value));
+	attributesList.add(new Attribute(qname, value, isSpecified));
 
     }
 
@@ -1212,31 +1200,31 @@
     {
 	if (index < 0 || index >= attributeCount) 
 	    throw new ArrayIndexOutOfBoundsException ();
-	return attributeDeclared [index];
+        String type = parser.getAttributeType(elementName, getQName(index));
+        return (type != null);
     }
 
     /** @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)
+    public boolean isDeclared (String qName)
     {
 	int index = getIndex (qName);
 	if (index < 0)
 	    throw new IllegalArgumentException ();
-	return attributeDeclared [index];
+        String type = parser.getAttributeType(elementName, qName);
+        return (type != null);
     }
 
     /** @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)
+    public boolean isDeclared (String uri, String localName)
     {
 	int index = getIndex (uri, localName);
-	if (index < 0)
-	    throw new IllegalArgumentException ();
-	return attributeDeclared [index];
+        return isDeclared(index);
     }
 
 
@@ -1245,9 +1233,7 @@
      */
     public boolean isSpecified (int index)
     {
-	if (index < 0 || index >= attributeCount) 
-	    throw new ArrayIndexOutOfBoundsException ();
-	return attributeSpecified [index];
+	return ((Attribute) attributesList.get(index)).specified;
     }
 
     /**
@@ -1256,10 +1242,7 @@
     public boolean isSpecified (String uri, String local)
     {
 	int index = getIndex (uri, local);
-
-	if (index < 0)
-	    throw new IllegalArgumentException ();
-	return attributeSpecified [index];
+        return isSpecified(index);
     }
 
     /**
@@ -1268,10 +1251,7 @@
     public boolean isSpecified (String xmlName)
     {
 	int index = getIndex (xmlName);
-
-	if (index < 0)
-	    throw new IllegalArgumentException ();
-	return attributeSpecified [index];
+        return isSpecified(index);
     }
 
 
@@ -1374,12 +1354,14 @@
     String value;
     String nameSpace;
     String localName;
+    boolean specified;
 
-    Attribute(String name, String value)
+    Attribute(String name, String value, boolean specified)
     {
         this.name = name;
         this.value = value;
         this.nameSpace = "";
+        this.specified = specified;
     }
 }
 



More information about the kaffe mailing list