Author: onealj
Date: Wed Oct 18 14:29:56 2017
New Revision: 1812520
URL: http://svn.apache.org/viewvc?rev=1812520&view=rev
Log:
cleanup for r1812475: avoid NPEs from string.isEmpty()
Modified:
poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExportToXml.java
Modified:
poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExportToXml.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExportToXml.java?rev=1812520&r1=1812519&r2=1812520&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExportToXml.java
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExportToXml.java
Wed Oct 18 14:29:56 2017
@@ -163,7 +163,8 @@ public class XSSFExportToXml implements
mapCellOnNode(cell,currentNode);
//remove nodes which are empty in order to keep the
output xml valid
- if (currentNode.getTextContent().isEmpty() &&
currentNode.getParentNode() != null) {
+ // FIXME: what should be done if
currentNode.getTextContent() is null?
+ if ("".equals(currentNode.getTextContent()) &&
currentNode.getParentNode() != null) {
currentNode.getParentNode().removeChild(currentNode);
}
}
@@ -467,7 +468,8 @@ public class XSSFExportToXml implements
// Note: we expect that all the complex types are defined at root level
Node complexTypeNode = null;
- if (!complexTypeName.isEmpty()) {
+ // FIXME: what should be done if complexTypeName is null?
+ if (!"".equals(complexTypeName)) {
complexTypeNode = getComplexTypeNodeFromSchemaChildren(xmlSchema,
null, complexTypeName);
}
@@ -483,8 +485,7 @@ public class XSSFExportToXml implements
NodeList list = localComplexTypeRootNode.getChildNodes();
String complexTypeName = "";
- for(int i=0; i< list.getLength();i++) {
- Node node = list.item(i);
+ for(final Node node : list) {
if ( node instanceof Element &&
"element".equals(node.getLocalName())) {
Node nameAttribute = getNameOrRefElement(node);
if
(nameAttribute.getNodeValue().equals(elementNameWithoutNamespace)) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]