Commit 8d06274e by Tom Tromey

[multiple changes]

2005-03-26  Chris Burdess  <dog@gnu.org>

	* gnu/xml/dom/DomNode.java (notifyNode): grow listener array as
	required.

2005-03-13  Michael Koch  <konqueror@gmx.de>

	* gnu/xml/aelfred2/XmlParser.java: Fixed typo.

2005-03-11  Chris Burdess  <dog@gnu.org>

	* gnu/xml/aelfred2/SAXDriver.java: Corrected bug handling URI
	warnings.

2005-02-27  Chris Burdess  <dog@gnu.org>

	* gnu/xml/aelfred2/JAXPFactory.java,
	gnu/xml/aelfred2/SAXDriver.java,
	gnu/xml/aelfred2/XmlParser.java,
	gnu/xml/aelfred2/XmlReader.java: Applied GNU Classpath source code
	formatting conventions. Replaced arrays of Object with struct-like
	classes for easier maintainability. Made SAXDriver.stringInterning
	package private to allow access from XmlParser inside the loop without
	a method call overhead.

2005-03-11  Chris Burdess  <dog@gnu.org>

	* gnu/xml/aelfred2/SAXDriver.java: Corrected bug handling URI
	warnings.

From-SVN: r97200
parent 1fff69c9
2005-03-26 Chris Burdess <dog@gnu.org>
* gnu/xml/dom/DomNode.java (notifyNode): grow listener array as
required.
2005-03-13 Michael Koch <konqueror@gmx.de>
* gnu/xml/aelfred2/XmlParser.java: Fixed typo.
2005-03-11 Chris Burdess <dog@gnu.org>
* gnu/xml/aelfred2/SAXDriver.java: Corrected bug handling URI
warnings.
2005-02-27 Chris Burdess <dog@gnu.org>
* gnu/xml/aelfred2/JAXPFactory.java,
gnu/xml/aelfred2/SAXDriver.java,
gnu/xml/aelfred2/XmlParser.java,
gnu/xml/aelfred2/XmlReader.java: Applied GNU Classpath source code
formatting conventions. Replaced arrays of Object with struct-like
classes for easier maintainability. Made SAXDriver.stringInterning
package private to allow access from XmlParser inside the loop without
a method call overhead.
2005-03-11 Chris Burdess <dog@gnu.org>
* gnu/xml/aelfred2/SAXDriver.java: Corrected bug handling URI
warnings.
2005-03-28 Alexandre Oliva <aoliva@redhat.com> 2005-03-28 Alexandre Oliva <aoliva@redhat.com>
* configure.ac: Revert 2005-03-25's patch. Propagate MULTIlib * configure.ac: Revert 2005-03-25's patch. Propagate MULTIlib
......
...@@ -60,35 +60,38 @@ import javax.xml.parsers.SAXParserFactory; ...@@ -60,35 +60,38 @@ import javax.xml.parsers.SAXParserFactory;
* *
* @author David Brownell * @author David Brownell
*/ */
public final class JAXPFactory extends SAXParserFactory public final class JAXPFactory
extends SAXParserFactory
{ {
private Hashtable flags = new Hashtable ();
private Hashtable flags = new Hashtable();
/** /**
* Constructs a factory which normally returns a non-validating * Constructs a factory which normally returns a non-validating
* parser. * parser.
*/ */
public JAXPFactory () { } public JAXPFactory()
{
}
public SAXParser newSAXParser () public SAXParser newSAXParser()
throws ParserConfigurationException, SAXException throws ParserConfigurationException, SAXException
{ {
JaxpParser jaxp = new JaxpParser (); JaxpParser jaxp = new JaxpParser();
Enumeration e = flags.keys (); Enumeration e = flags.keys();
XMLReader parser = jaxp.getXMLReader (); XMLReader parser = jaxp.getXMLReader();
parser.setFeature ( parser.setFeature(SAXDriver.FEATURE + "namespaces",
SAXDriver.FEATURE + "namespaces", isNamespaceAware());
isNamespaceAware ()); parser.setFeature(SAXDriver.FEATURE + "validation",
parser.setFeature ( isValidating());
SAXDriver.FEATURE + "validation",
isValidating ());
// that makes SAX2 feature flags trump JAXP // that makes SAX2 feature flags trump JAXP
while (e.hasMoreElements ()) { while (e.hasMoreElements())
String uri = (String) e.nextElement (); {
Boolean value = (Boolean) flags.get (uri); String uri = (String) e.nextElement();
parser.setFeature (uri, value.booleanValue ()); Boolean value = (Boolean) flags.get(uri);
parser.setFeature(uri, value.booleanValue());
} }
return jaxp; return jaxp;
...@@ -96,101 +99,133 @@ public final class JAXPFactory extends SAXParserFactory ...@@ -96,101 +99,133 @@ public final class JAXPFactory extends SAXParserFactory
// yes, this "feature transfer" mechanism doesn't play well // yes, this "feature transfer" mechanism doesn't play well
public void setFeature (String name, boolean value) public void setFeature(String name, boolean value)
throws throws ParserConfigurationException, SAXNotRecognizedException,
ParserConfigurationException,
SAXNotRecognizedException,
SAXNotSupportedException SAXNotSupportedException
{ {
try { try
{
// force "early" detection of errors where possible // force "early" detection of errors where possible
// (flags can't necessarily be set before parsing) // (flags can't necessarily be set before parsing)
new JaxpParser ().getXMLReader ().setFeature (name, value); new JaxpParser().getXMLReader().setFeature(name, value);
flags.put (name, new Boolean (value)); flags.put(name, new Boolean(value));
} catch (SAXNotRecognizedException e) { }
throw new SAXNotRecognizedException (name); catch (SAXNotRecognizedException e)
} catch (SAXNotSupportedException e) { {
throw new SAXNotSupportedException (name); throw new SAXNotRecognizedException(name);
} catch (Exception e) { }
throw new ParserConfigurationException ( catch (SAXNotSupportedException e)
e.getClass ().getName () {
throw new SAXNotSupportedException(name);
}
catch (Exception e)
{
throw new ParserConfigurationException(e.getClass().getName()
+ ": " + ": "
+ e.getMessage ()); + e.getMessage());
} }
} }
public boolean getFeature (String name) public boolean getFeature(String name)
throws throws ParserConfigurationException, SAXNotRecognizedException,
ParserConfigurationException,
SAXNotRecognizedException,
SAXNotSupportedException SAXNotSupportedException
{ {
Boolean value = (Boolean) flags.get (name); Boolean value = (Boolean) flags.get(name);
if (value != null) if (value != null)
return value.booleanValue (); {
return value.booleanValue();
}
else else
try { {
return new JaxpParser ().getXMLReader ().getFeature (name); try
} catch (SAXNotRecognizedException e) { {
throw new SAXNotRecognizedException (name); return new JaxpParser().getXMLReader().getFeature(name);
} catch (SAXNotSupportedException e) { }
throw new SAXNotSupportedException (name); catch (SAXNotRecognizedException e)
} catch (SAXException e) { {
throw new ParserConfigurationException ( throw new SAXNotRecognizedException(name);
e.getClass ().getName () }
catch (SAXNotSupportedException e)
{
throw new SAXNotSupportedException(name);
}
catch (SAXException e)
{
throw new ParserConfigurationException(e.getClass().getName()
+ ": " + ": "
+ e.getMessage ()); + e.getMessage());
}
} }
} }
private static class JaxpParser extends SAXParser private static class JaxpParser
extends SAXParser
{ {
private XmlReader ae2 = new XmlReader ();
private XmlReader ae2 = new XmlReader();
private XMLReaderAdapter parser = null; private XMLReaderAdapter parser = null;
JaxpParser () { } JaxpParser()
{
}
public void setProperty (String id, Object value) public void setProperty(String id, Object value)
throws SAXNotRecognizedException, SAXNotSupportedException throws SAXNotRecognizedException, SAXNotSupportedException
{ ae2.setProperty (id, value); } {
ae2.setProperty(id, value);
}
public Object getProperty (String id) public Object getProperty(String id)
throws SAXNotRecognizedException, SAXNotSupportedException throws SAXNotRecognizedException, SAXNotSupportedException
{ return ae2.getProperty (id); } {
return ae2.getProperty(id);
}
public Parser getParser () public Parser getParser()
throws SAXException throws SAXException
{ {
if (parser == null) if (parser == null)
parser = new XMLReaderAdapter (ae2); {
parser = new XMLReaderAdapter(ae2);
}
return parser; return parser;
} }
public XMLReader getXMLReader () public XMLReader getXMLReader ()
throws SAXException throws SAXException
{ return ae2; } {
return ae2;
}
public boolean isNamespaceAware () public boolean isNamespaceAware()
{
try
{
return ae2.getFeature(SAXDriver.FEATURE + "namespaces");
}
catch (Exception e)
{ {
try { throw new Error();
return ae2.getFeature (SAXDriver.FEATURE + "namespaces");
} catch (Exception e) {
throw new Error ();
} }
} }
public boolean isValidating () public boolean isValidating()
{ {
try { try
return ae2.getFeature (SAXDriver.FEATURE + "validation"); {
} catch (Exception e) { return ae2.getFeature(SAXDriver.FEATURE + "validation");
throw new Error (); }
catch (Exception e)
{
throw new Error();
} }
} }
// TODO isXIncludeAware() // TODO isXIncludeAware()
} }
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -1686,13 +1686,16 @@ public abstract class DomNode ...@@ -1686,13 +1686,16 @@ public abstract class DomNode
{ {
continue; continue;
} }
if (count < notificationSet.length) if (count >= notificationSet.length)
{ {
notificationSet[count++] = rec; // very simple growth algorithm
int len = Math.max(notificationSet.length, 1);
ListenerRecord[] tmp = new ListenerRecord[len * 2];
System.arraycopy(notificationSet, 0, tmp, 0,
notificationSet.length);
notificationSet = tmp;
} }
else notificationSet[count++] = rec;
// XXX fire up some cheap growth algorithm
throw new RuntimeException("Event notification set size exceeded");
} }
// Notify just those listeners // Notify just those listeners
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment