-
Bug
-
Resolution: Fixed
-
P4
-
1.4.1
-
1.1fcs
-
generic
-
generic
-
Verified
Name: inR10064 Date: 10/20/2000
JAXP 1.1 method javax.xml.parsers.SAXParserFactory.setFeature(String name,
boolean value)
throws an SAXNotRecognizedException when it's used to set a feature
"http://xml.org/sax/features/namespaces" (See test1.java below).
But this feature should be recognized by the method.
p. 4.1.8 "public abstract void setFeature(String name, boolean value)"
of JAXP 1.1 spec (jaxp-pd1.pdf) reads :
" Throws a SAXNotRecognizedException if the underlying parser can't recognize
the option. "
SAX 2.0 specification (http://www.megginson.com/SAX/Java/features.html) requires
that all org.xml.sax.XMLReader implementations should recognize and support the
"http://xml.org/sax/features/namespaces" and the
"http://xml.org/sax/features/namespace-prefixes" features.
Note that the method org.xml.sax.XMLReader.setFeature() processes such argument
correctly (See test2.java below).
This bug present in builds jaxp-1.1ea-b8 and jaxp-1.1fcs-b9 and affects
new tests in TCK JAXP 1.1
api/javax_xml_parsers/SAXParserFactory/GetFeatureTests.html
api/javax_xml_parsers/SAXParserFactory/SetFeatureTests.html
------------------------------------test1.java-----------------------------
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.SAXNotRecognizedException;
public class test1 {
public static void main(String argv[]) {
try {
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setFeature("http://xml.org/sax/features/namespaces", false);
System.out.println("OKEY");
} catch (SAXNotRecognizedException e) {
System.out.println("The feature wasn't recognized.");
} catch (Throwable e) {
System.out.println("Unexpected exception: " + e);
}
}
}
---------------------------------------------------------------------------
------------------------------------test2.java-----------------------------
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.XMLReader;
public class test2 {
public static void main(String argv[]) {
try {
XMLReader parser = SAXParserFactory.newInstance().newSAXParser()
.getXMLReader();
parser.setFeature("http://xml.org/sax/features/namespaces", false);
System.out.println("OKEY");
} catch (SAXNotRecognizedException e) {
System.out.println("The feature wasn't recognized.");
} catch (Throwable e) {
System.out.println("Unexpected exception: " + e);
}
}
}
---------------------------------------------------------------------------
---------------------------------------------------------------------------
% java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, interpreted mode)
% java test1
The feature wasn't recognized.
% java test2
OKEY
---------------------------------------------------------------------------
======================================================================