incubator-odf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alain Fagot Béarez (JIRA) <j...@apache.org>
Subject [jira] [Commented] (ODFTOOLKIT-367) Paragraph.getTextContent throws NullPointerException with exactly 2 spaces between words
Date Wed, 03 Jul 2013 12:10:20 GMT

    [ https://issues.apache.org/jira/browse/ODFTOOLKIT-367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13698882#comment-13698882
] 

Alain Fagot Béarez commented on ODFTOOLKIT-367:
-----------------------------------------------

Index: simple/src/main/java/org/odftoolkit/simple/text/Paragraph.java
===================================================================
I fixed it as follows:

--- simple/src/main/java/org/odftoolkit/simple/text/Paragraph.java	(revision 1499231)
+++ simple/src/main/java/org/odftoolkit/simple/text/Paragraph.java	(working copy)
@@ -236,7 +236,8 @@
 				buffer.append(node.getNodeValue());
 			else if (node.getNodeType() == Node.ELEMENT_NODE) {
 				if (node.getNodeName().equals("text:s")) {
-					int count = ((TextSElement) node).getTextCAttribute();
+					Integer cAttribute = ((TextSElement) node).getTextCAttribute();
+					int count = (cAttribute == null) ? 1 : cAttribute.intValue();
 					for (int j = 0; j < count; j++)
 						buffer.append(' ');
 				} else if (node.getNodeName().equals("text:tab"))

                
> Paragraph.getTextContent throws NullPointerException with exactly 2 spaces between words
> ----------------------------------------------------------------------------------------
>
>                 Key: ODFTOOLKIT-367
>                 URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-367
>             Project: ODF Toolkit
>          Issue Type: Bug
>          Components: simple api
>            Reporter: Alain Fagot Béarez
>            Priority: Critical
>
> When the paragraph has exactly 2 spaces between words, the underlying markup has a <text:s/>
element with no attribute. 
> The current implementation reads the number of spaces from the c attribute, which is
set only for values greater than 1.

--
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

Mime
View raw message