-
Bug
-
Resolution: Unresolved
-
P4
-
8, 11, 17, 22, 23
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
The issue described inJDK-6770436 also occurs for non-predefined entities.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use a DefaultHandler2, register lexical-handler, and parse this document:
<!DOCTYPE x [<!ENTITY e "v">]><x>&e;</x>
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
startEntity: e
characters: v
endEntity: e
ACTUAL -
startEntity: e
endEntity: e
characters: v
---------- BEGIN SOURCE ----------
import java.io.ByteArrayInputStream;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.ext.DefaultHandler2;
public class XmlEntityTest {
public static void main(String[] args) throws Exception {
var p = SAXParserFactory.newInstance().newSAXParser();
var h = new DefaultHandler2() {
public void startEntity(String name) {
System.err.println("startEntity: " + name);
}
public void endEntity(String name) {
System.err.println("endEntity: " + name);
}
public void characters(char[] ch, int start, int length) {
System.err.println("characters: " + new String(ch, start, length));
}
};
p.setProperty("http://xml.org/sax/properties/lexical-handler", h);
String xml = "<!DOCTYPE x [<!ENTITY e \"v\">]><x>&e;</x>";
p.parse(new ByteArrayInputStream(xml.getBytes()), h);
}
}
---------- END SOURCE ----------
FREQUENCY : always
The issue described in
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use a DefaultHandler2, register lexical-handler, and parse this document:
<!DOCTYPE x [<!ENTITY e "v">]><x>&e;</x>
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
startEntity: e
characters: v
endEntity: e
ACTUAL -
startEntity: e
endEntity: e
characters: v
---------- BEGIN SOURCE ----------
import java.io.ByteArrayInputStream;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.ext.DefaultHandler2;
public class XmlEntityTest {
public static void main(String[] args) throws Exception {
var p = SAXParserFactory.newInstance().newSAXParser();
var h = new DefaultHandler2() {
public void startEntity(String name) {
System.err.println("startEntity: " + name);
}
public void endEntity(String name) {
System.err.println("endEntity: " + name);
}
public void characters(char[] ch, int start, int length) {
System.err.println("characters: " + new String(ch, start, length));
}
};
p.setProperty("http://xml.org/sax/properties/lexical-handler", h);
String xml = "<!DOCTYPE x [<!ENTITY e \"v\">]><x>&e;</x>";
p.parse(new ByteArrayInputStream(xml.getBytes()), h);
}
}
---------- END SOURCE ----------
FREQUENCY : always
- relates to
-
JDK-6770436 Entity callback order differs between Java1.5 and Java1.6
- Resolved