Applied fix from trunk for revision: 1855898
=== Improved: Moved the nodeType check after node.getTextContent() method call (OFBIZ-10832) Since most nodes will contain text then it will be more efficient to do a null check after retrieving nodeValue. Thanks: Scott for your valuable inputs. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1855899 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -516,17 +516,20 @@ public class ObjectType {
|
||||
if (obj instanceof Node) {
|
||||
Node node = (Node) obj;
|
||||
|
||||
/* We can't get the text value of Document, Document Type and Notation Node,
|
||||
* thus simply returning the same object from simpleTypeOrObjectConvert method.
|
||||
* Please refer to OFBIZ-10832 Jira and
|
||||
* https://docs.oracle.com/javase/7/docs/api/org/w3c/dom/Node.html#getTextContent() for more details.
|
||||
*/
|
||||
short nodeType = node.getNodeType();
|
||||
if (Node.DOCUMENT_NODE == nodeType || Node.DOCUMENT_TYPE_NODE == nodeType || Node.NOTATION_NODE == nodeType) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
String nodeValue = node.getTextContent();
|
||||
|
||||
if (nodeValue == null) {
|
||||
/* We can't get the text value of Document, Document Type and Notation Node,
|
||||
* thus simply returning the same object from simpleTypeOrObjectConvert method.
|
||||
* Please refer to OFBIZ-10832 Jira and
|
||||
* https://docs.oracle.com/javase/7/docs/api/org/w3c/dom/Node.html#getTextContent() for more details.
|
||||
*/
|
||||
short nodeType = node.getNodeType();
|
||||
if (Node.DOCUMENT_NODE == nodeType || Node.DOCUMENT_TYPE_NODE == nodeType || Node.NOTATION_NODE == nodeType) {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
if ("String".equals(type) || "java.lang.String".equals(type)) {
|
||||
return nodeValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user