all getParameterNames to get a list of parameter names known to the
DOM implementation. Call getParameter( name ) to get the current setting
of each supposedly known parameter.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
getParameter should never reject a parameter name from getParameterNames
as unknown (or getParameterNames should never return an unknown
parameter).
ACTUAL -
(See exact error below.)
getParameter throws a FEATURE_NOT_FOUND DOMException, saying it
doesn't recognize the feature name even though the feature name came
right from the DOM implementation.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
org.w3c.dom.DOMException: FEATURE_NOT_FOUND: The parameter
http://xml.org/sax/features/validation is not recognized.
at com.sun.org.apache.xerces.internal.dom.DOMConfigurationImpl.getParameter(DOM
ConfigurationImpl.java:863)
at prototype.ExploreDOM.main(Bug.java:29)
Exception in thread "main"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.xml.parsers.*;
import org.w3c.dom.*;
class Bug
{
public static void main( String[] args )
throws Exception
{
DocumentBuilder builder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
DOMConfiguration config = builder.newDocument().getDomConfig();
{
DOMStringList names = config.getParameterNames();
for ( int sx = 0; sx < names.getLength(); sx++ ) {
String name = names.item( sx );
Object value = config.getParameter( name );
// Throws exception:
// org.w3c.dom.DOMException: FEATURE_NOT_FOUND: The parameter
http://xml.org/sax/features/validation is not recognized.
// at com.sun.org.apache.xerces.internal.dom.DOMConfigurationImpl.getParameter(
DOMConfigurationImpl.java:863)
// at prototype.ExploreDOM.main(Bug.java:29)
}
}
} // main( String[] )
} // class Bug