-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
1.4
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2153437 | 7 | Joe Wang | P3 | Closed | Fixed | b14 |
JDK-2144027 | 6u2 | Santiago Pericasgeertsen | P3 | Resolved | Fixed | b01 |
com.sun.org.apache.xalan.internal.xsltc.trax.SAX2DOM has the following code:
-----------------
public SAX2DOM() throws ParserConfigurationException {
final DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
_document = factory.newDocumentBuilder().newDocument();
_root = _document;
}
public SAX2DOM(Node root) throws ParserConfigurationException {
_root = root;
if (root instanceof Document) {
_document = (Document)root;
}
else if (root != null) {
_document = root.getOwnerDocument();
}
else {
final DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
_document = factory.newDocumentBuilder().newDocument();
_root = _document;
}
}
-----------------
This is showing up as a hot spot in JAX-WS because a new DocumentBuilderFactory is created every time. The factory should be created only once and set to a static final field, then reused.
-----------------
public SAX2DOM() throws ParserConfigurationException {
final DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
_document = factory.newDocumentBuilder().newDocument();
_root = _document;
}
public SAX2DOM(Node root) throws ParserConfigurationException {
_root = root;
if (root instanceof Document) {
_document = (Document)root;
}
else if (root != null) {
_document = root.getOwnerDocument();
}
else {
final DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
_document = factory.newDocumentBuilder().newDocument();
_root = _document;
}
}
-----------------
This is showing up as a hot spot in JAX-WS because a new DocumentBuilderFactory is created every time. The factory should be created only once and set to a static final field, then reused.
- backported by
-
JDK-2144027 SAX2DOM creates JAXP SAXParserFactory unnecessarily
-
- Resolved
-
-
JDK-2153437 SAX2DOM creates JAXP SAXParserFactory unnecessarily
-
- Closed
-