Findbugs fix

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1774556 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Murphy 2016-12-16 05:17:38 +00:00
parent e5384f8dd6
commit 7e1c3ec4b3
2 changed files with 6 additions and 7 deletions

View File

@ -20,14 +20,14 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.STOnOff;
public final class WMLHelper { public final class WMLHelper {
public static boolean STOnOffToBoolean (STOnOff.Enum value) { public static boolean convertSTOnOffToBoolean (STOnOff.Enum value) {
if (value == STOnOff.TRUE || value == STOnOff.ON || value == STOnOff.X_1) { if (value == STOnOff.TRUE || value == STOnOff.ON || value == STOnOff.X_1) {
return true; return true;
} }
return false; return false;
} }
public static STOnOff.Enum BooleanToSTOnOff (boolean value) { public static STOnOff.Enum convertBooleanToSTOnOff (boolean value) {
return (value ? STOnOff.TRUE : STOnOff.FALSE); return (value ? STOnOff.TRUE : STOnOff.FALSE);
} }
} }

View File

@ -30,7 +30,6 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRow;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSdtCell; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSdtCell;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTrPr; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTrPr;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STOnOff;
/** /**
@ -197,7 +196,7 @@ public class XWPFTableRow {
CTTrPr trpr = getTrPr(); CTTrPr trpr = getTrPr();
if (trpr.sizeOfCantSplitArray() > 0) { if (trpr.sizeOfCantSplitArray() > 0) {
CTOnOff onoff = trpr.getCantSplitArray(0); CTOnOff onoff = trpr.getCantSplitArray(0);
isCant = (onoff.isSetVal() ? WMLHelper.STOnOffToBoolean(onoff.getVal()) : true); isCant = (onoff.isSetVal() ? WMLHelper.convertSTOnOffToBoolean(onoff.getVal()) : true);
} }
} }
return isCant; return isCant;
@ -214,7 +213,7 @@ public class XWPFTableRow {
public void setCantSplitRow(boolean split) { public void setCantSplitRow(boolean split) {
CTTrPr trpr = getTrPr(); CTTrPr trpr = getTrPr();
CTOnOff onoff = (trpr.sizeOfCantSplitArray() > 0 ? trpr.getCantSplitArray(0) : trpr.addNewCantSplit()); CTOnOff onoff = (trpr.sizeOfCantSplitArray() > 0 ? trpr.getCantSplitArray(0) : trpr.addNewCantSplit());
onoff.setVal(WMLHelper.BooleanToSTOnOff(split)); onoff.setVal(WMLHelper.convertBooleanToSTOnOff(split));
} }
/** /**
@ -244,7 +243,7 @@ public class XWPFTableRow {
CTTrPr trpr = getTrPr(); CTTrPr trpr = getTrPr();
if (trpr.sizeOfTblHeaderArray() > 0) { if (trpr.sizeOfTblHeaderArray() > 0) {
CTOnOff rpt = trpr.getTblHeaderArray(0); CTOnOff rpt = trpr.getTblHeaderArray(0);
repeat = (rpt.isSetVal() ? WMLHelper.STOnOffToBoolean(rpt.getVal()) : true); repeat = (rpt.isSetVal() ? WMLHelper.convertSTOnOffToBoolean(rpt.getVal()) : true);
} }
} }
return repeat; return repeat;
@ -261,6 +260,6 @@ public class XWPFTableRow {
public void setRepeatHeader(boolean repeat) { public void setRepeatHeader(boolean repeat) {
CTTrPr trpr = getTrPr(); CTTrPr trpr = getTrPr();
CTOnOff onoff = (trpr.sizeOfTblHeaderArray() > 0 ? trpr.getTblHeaderArray(0) : trpr.addNewTblHeader()); CTOnOff onoff = (trpr.sizeOfTblHeaderArray() > 0 ? trpr.getTblHeaderArray(0) : trpr.addNewTblHeader());
onoff.setVal(WMLHelper.BooleanToSTOnOff(repeat)); onoff.setVal(WMLHelper.convertBooleanToSTOnOff(repeat));
} }
} }