Hello,
It looks like there is a bug in OdfElement.getLastChildElement() method:
public OdfElement getLastChildElement() {
OdfElement lastElementChild = null;
NodeList nodeList = this.getChildNodes();
Node node = nodeList.item(0);
for (int i = nodeList.getLength(); i >= 0; i--) {
if (node instanceof OdfElement) {
lastElementChild = (OdfElement) node;
break;
}
}
return lastElementChild;
}
The loop there does noting. Only if first child node will be and instance of OdfElement, the node will be returned. Otherwise, the null value will be returned. I think the correct code should be as below:
public OdfElement getLastChildElement() {
OdfElement lastElementChild = null;
NodeList nodeList = this.getChildNodes();
for (int i = nodeList.getLength(); i >= 0; i--) {
Node node = nodeList.item(i);
if (node instanceof OdfElement) {
lastElementChild = (OdfElement) node;
break;
}
}
return lastElementChild;
}
Please correct me if my understanding of this method is wrong but I think its name is self explanatory.
Hello,
It looks like there is a bug in
OdfElement.getLastChildElement()method:The loop there does noting. Only if first child node will be and instance of OdfElement, the node will be returned. Otherwise, the null value will be returned. I think the correct code should be as below:
Please correct me if my understanding of this method is wrong but I think its name is self explanatory.