[
https://issues.apache.org/jira/browse/ODFTOOLKIT-195?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Florian Hopf updated ODFTOOLKIT-195:
------------------------------------
Fix Version/s: (was: odfdom-0.8.7)
> Exception when remove Table in odt
> ----------------------------------
>
> Key: ODFTOOLKIT-195
> URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-195
> Project: ODF Toolkit
> Issue Type: Improvement
> Components: java
> Affects Versions: odfdom-0.8.6
> Environment: Operating System: Windows
> Platform: PC
> Reporter: Ying Chun Guo
> Assignee: issues
> Priority: Minor
>
> One of ODFDOM user reported a NPE exception when removing a table element.
> The exception was:
> testIndexTable(com.ibm.symphony.conversion.service.junit.cases.TestConversionServiceWithTargetFolder)java.lang.NullPointerException
> at org.odftoolkit.odfdom.OdfElement.equals(OdfElement.java:408)
> at java.util.ArrayList.indexOf(ArrayList.java:461)
> at java.util.ArrayList.remove(ArrayList.java:570)
> at
> org.odftoolkit.odfdom.dom.element.OdfStyleBase.removeStyleUser(OdfStyleBase.java:159)
> at
> org.odftoolkit.odfdom.dom.element.OdfStylableElement.onRemoveNode(OdfStylableElement.java:445)
> at org.odftoolkit.odfdom.OdfElement.onRemoveNode(OdfElement.java:476)
> at org.odftoolkit.odfdom.OdfElement.onRemoveNode(OdfElement.java:471)
> at org.odftoolkit.odfdom.OdfElement.removeChild(OdfElement.java:506)
> at ......
> I looked into the code. The NPE happens in:
> Public boolean equals(Object obj) {
> ......
> if (n1.getLocalName().equals(n2.getLocalName())
> && n1.getNamespaceURI().equals(n2.getNamespaceURI())) {
> break;
> }
> ......
> }
> The problem is caused by an XML attribute added by user without a namespace,
> such as "key=123".
> I think ODFDOM should support this case, to avoid NPE.
> Patch will be uploaded latter.
> Daisy
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira