You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Kohsuke KAWAGUCHI <ko...@eng.sun.com> on 2001/03/29 05:50:04 UTC

A bug in JAXP support of crimson parser

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


Re: A bug in JAXP support of crimson parser

Posted by Kohsuke KAWAGUCHI <ko...@eng.sun.com>.
> OK, thanks for the bug fix.  I've applied the fix to crimson, Xerces
> 1.x, and Xerces 2.x.

I'm glad to know that it will help a little.

regards,
----------------------
K.Kawaguchi


---------------------------------------------------------------------
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


Re: A bug in JAXP support of crimson parser

Posted by Edwin Goei <Ed...@sun.com>.
Kohsuke KAWAGUCHI wrote:
> 
> 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.

OK, thanks for the bug fix.  I've applied the fix to crimson, Xerces
1.x, and Xerces 2.x.

-Edwin

---------------------------------------------------------------------
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