[
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 edited comment on ODFTOOLKIT-367 at 7/3/13 12:09 PM:
------------------------------------------------------------------------
I fixed it as follows:
Index: simple/src/main/java/org/odftoolkit/simple/text/Paragraph.java
===================================================================
--- 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"))
was (Author: kameleono):
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