xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kohsuke KAWAGUCHI <kohsuke.kawagu...@eng.sun.com>
Subject A bug in JAXP support of crimson parser
Date Thu, 29 Mar 2001 03:50:04 GMT

Hi,

I found a bug in org.apache.crimson.jaxp.SAXParserFactoryImpl.

Its setFeature method should catch an exception and remove unrecognized
feature from "features" field. Otherwise, any further attempt to call
newSAXParser will fail.

The following is the modified code.


    /**
     * Sets the particular feature in the underlying implementation of 
     * org.xml.sax.XMLReader.
     */
    public void setFeature(String name, boolean value)
        throws ParserConfigurationException, SAXNotRecognizedException, 
		SAXNotSupportedException
    {
        // XXX This is ugly.  We have to collect the features and then
        // later create an XMLReader to verify the features.
        if (features == null) {
            features = new Hashtable();
        }
        features.put(name, new Boolean(value));

        // Test the feature by possibly throwing SAX exceptions
        try {
          newSAXParser0();
        } catch( SAXNotRecognizedException e ) {
          features.remove(name);
          throw e;
        } catch( SAXNotSupportedException e ) {
          features.remove(name);
          throw e;
        }
    }

regards,
----------------------
K.Kawaguchi
E-Mail: kohsuke.kawaguchi@eng.sun.com


---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Mime
View raw message