aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java
diff options
context:
space:
mode:
authorMark Murphy <jmarkmurphy@apache.org>2016-12-16 06:00:35 +0000
committerMark Murphy <jmarkmurphy@apache.org>2016-12-16 06:00:35 +0000
commitf435ae51293c1776549e3ca77d6ec224577364ce (patch)
tree0f84621fa9efbf3ac5ae2b9dab00f99e1f408140 /src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java
parent7e1c3ec4b3fabede2d14f629790c46060059b780 (diff)
downloadpoi-f435ae51293c1776549e3ca77d6ec224577364ce.tar.gz
poi-f435ae51293c1776549e3ca77d6ec224577364ce.zip
SonarCube fixes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1774557 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java')
-rw-r--r--src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java
index a58d0b97e0..55a7f9a0d1 100644
--- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java
+++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java
@@ -828,10 +828,10 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
*/
public boolean isPageBreak() {
CTPPr ppr = getCTPPr();
- CTOnOff ct_pageBreak = ppr.isSetPageBreakBefore() ? ppr
+ CTOnOff ctPageBreak = ppr.isSetPageBreakBefore() ? ppr
.getPageBreakBefore() : null;
- if (ct_pageBreak != null
- && ct_pageBreak.getVal().intValue() == STOnOff.INT_TRUE) {
+ if (ctPageBreak != null
+ && ctPageBreak.getVal().intValue() == STOnOff.INT_TRUE) {
return true;
}
return false;
@@ -855,12 +855,12 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
*/
public void setPageBreak(boolean pageBreak) {
CTPPr ppr = getCTPPr();
- CTOnOff ct_pageBreak = ppr.isSetPageBreakBefore() ? ppr
+ CTOnOff ctPageBreak = ppr.isSetPageBreakBefore() ? ppr
.getPageBreakBefore() : ppr.addNewPageBreakBefore();
if (pageBreak)
- ct_pageBreak.setVal(STOnOff.TRUE);
+ ctPageBreak.setVal(STOnOff.TRUE);
else
- ct_pageBreak.setVal(STOnOff.FALSE);
+ ctPageBreak.setVal(STOnOff.FALSE);
}
/**
@@ -1463,10 +1463,11 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
if (o instanceof CTText) {
if (textPos >= startText) {
String candidate = ((CTText) o).getStringValue();
- if (runPos == startRun)
+ if (runPos == startRun) {
charPos = startChar;
- else
+ } else {
charPos = 0;
+ }
for (; charPos < candidate.length(); charPos++) {
if ((candidate.charAt(charPos) == searched.charAt(0)) && (candCharPos == 0)) {
@@ -1476,9 +1477,9 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
newList = true;
}
if (candidate.charAt(charPos) == searched.charAt(candCharPos)) {
- if (candCharPos + 1 < searched.length())
+ if (candCharPos + 1 < searched.length()) {
candCharPos++;
- else if (newList) {
+ } else if (newList) {
TextSegement segement = new TextSegement();
segement.setBeginRun(beginRunPos);
segement.setBeginText(beginTextPos);
@@ -1496,10 +1497,11 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
textPos++;
} else if (o instanceof CTProofErr) {
c.removeXml();
- } else if (o instanceof CTRPr) ;
+ } else if (o instanceof CTRPr) {
//do nothing
- else
+ } else {
candCharPos = 0;
+ }
}
} finally {
c.dispose();
@@ -1525,10 +1527,12 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
for (int i = runBegin; i <= runEnd; i++) {
CTText[] tArray = rArray[i].getTArray();
int startText = 0, endText = tArray.length - 1;
- if (i == runBegin)
+ if (i == runBegin) {
startText = textBegin;
- if (i == runEnd)
+ }
+ if (i == runEnd) {
endText = textEnd;
+ }
for (int j = startText; j <= endText; j++) {
String tmpText = tArray[j].getStringValue();
int startChar = 0, endChar = tmpText.length() - 1;
@@ -1566,8 +1570,9 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
int rPos = 0;
for(int i=0;i<pos;i++) {
XWPFRun currRun = runs.get(i);
- if(!(currRun instanceof XWPFHyperlinkRun || currRun instanceof XWPFFieldRun))
+ if(!(currRun instanceof XWPFHyperlinkRun || currRun instanceof XWPFFieldRun)) {
rPos++;
+ }
}
getCTP().removeR(rPos);
return true;