" of " + testCount + " evaluations failed to " +
"evaluate correctly.",
Project.MSG_ERR );
- if(showFailureDetail && failureMessages.size() > 0 ) {
+ if(showFailureDetail && !failureMessages.isEmpty()) {
for (String failureMessage : failureMessages) {
log(failureMessage, Project.MSG_ERR);
}
public void setText(String text) {
// keep the properties of current last run
XmlObject existing = null;
- if (_runs.size() > 0) {
+ if (!_runs.isEmpty()) {
existing = _runs.get(_runs.size() - 1).getProperties().copy();
}
// remove all runs
public XSLFTextRun addLineBreak(){
XSLFLineBreak run = new XSLFLineBreak(_p.addNewBr(), this);
CTTextCharacterProperties brProps = run.getRPr(true);
- if(_runs.size() > 0){
+ if (!_runs.isEmpty()) {
// by default line break has the font size of the last text run
CTTextCharacterProperties prevRun = _runs.get(_runs.size() - 1).getRPr(true);
brProps.set(prevRun);
pkg.getPartsByContentType(XSSFBRelation.SHARED_STRINGS_BINARY.getContentType());
// Some workbooks have no shared strings table.
- if (parts.size() > 0) {
+ if (!parts.isEmpty()) {
PackagePart sstPart = parts.get(0);
try (InputStream stream = sstPart.getInputStream()) {
readFrom(stream);
private void outputHeaderFooter(XSSFBHeaderFooter headerFooter) {
String text = headerFooter.getString();
- if (text != null && text.trim().length() > 0) {
+ if (text != null && !text.trim().isEmpty()) {
handler.headerFooter(text, headerFooter.isHeader(), headerFooter.getHeaderFooterTypeLabel());
}
}
return;
}
Queue<CellAddress> queue = comments.getAddresses();
- while (queue.size() > 0) {
+ while (!queue.isEmpty()) {
CellAddress cellAddress = queue.peek();
if (cellAddress.getRow() == currentRow && cellAddress.getColumn() < colNum) {
cellAddress = queue.remove();
}
Queue<CellAddress> queue = comments.getAddresses();
int lastInterpolatedRow = -1;
- while (queue.size() > 0) {
+ while (!queue.isEmpty()) {
CellAddress cellAddress = queue.peek();
if (currentRow == CHECK_ALL_ROWS || cellAddress.getRow() < currentRow) {
cellAddress = queue.remove();
pkg.getPartsByContentType(XSSFRelation.SHARED_STRINGS.getContentType());
// Some workbooks have no shared strings table.
- if (parts.size() > 0) {
+ if (!parts.isEmpty()) {
PackagePart sstPart = parts.get(0);
try (InputStream stream = sstPart.getInputStream()) {
readFrom(stream);
styleSheet.setBorders(ctBorders);
// Xfs
- if(xfs.size() > 0) {
+ if (!xfs.isEmpty()) {
CTCellXfs ctXfs = styleSheet.getCellXfs();
if (ctXfs == null) {
ctXfs = CTCellXfs.Factory.newInstance();
}
// Style xfs
- if(styleXfs.size() > 0) {
+ if (!styleXfs.isEmpty()) {
CTCellStyleXfs ctSXfs = styleSheet.getCellStyleXfs();
if (ctSXfs == null) {
ctSXfs = CTCellStyleXfs.Factory.newInstance();
}
// Style dxfs
- if(dxfs.size() > 0) {
+ if (!dxfs.isEmpty()) {
CTDxfs ctDxfs = styleSheet.getDxfs();
if (ctDxfs == null) {
ctDxfs = CTDxfs.Factory.newInstance();
}
// Now re-generate our CTHyperlinks, if needed
- if(hyperlinks.size() > 0) {
+ if (!hyperlinks.isEmpty()) {
if(worksheet.getHyperlinks() == null) {
worksheet.addNewHyperlinks();
}
public XSSFTextRun addLineBreak(){
CTTextLineBreak br = _p.addNewBr();
CTTextCharacterProperties brProps = br.addNewRPr();
- if(_runs.size() > 0){
+ if (!_runs.isEmpty()) {
// by default line break has the font size of the last text run
CTTextCharacterProperties prevRun = _runs.get(_runs.size() - 1).getRPr();
brProps.set(prevRun);
*/
private void saveNamedRanges(){
// Named ranges
- if(namedRanges.size() > 0) {
+ if (!namedRanges.isEmpty()) {
CTDefinedNames names = CTDefinedNames.Factory.newInstance();
CTDefinedName[] nr = new CTDefinedName[namedRanges.size()];
int i = 0;
public void ensureFootnoteRef(XWPFParagraph p) {
XWPFRun r = null;
- if (p.getRuns().size() > 0) {
+ if (!p.runsIsEmpty()) {
r = p.getRuns().get(0);
}
if (r == null) {
public void ensureFootnoteRef(XWPFParagraph p) {
XWPFRun r = null;
- if (p.getRuns().size() > 0) {
+ if (!p.runsIsEmpty()) {
r = p.getRuns().get(0);
}
if (r == null) {
return Collections.unmodifiableList(runs);
}
+ public boolean runsIsEmpty() {
+ return runs.isEmpty();
+ }
+
/**
* Return literal runs and sdt/content control objects.
*/
void testBug59026() throws Exception {
try (XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("59026.xlsx")) {
Collection<XSSFMap> mappings = wb.getCustomXMLMappings();
- assertTrue(mappings.size() > 0);
+ assertFalse(mappings.isEmpty());
for (XSSFMap map : mappings) {
XSSFExportToXml exporter = new XSSFExportToXml(map);
// Add the new picture in
int offset = 0;
- if (_pictures.size() > 0) {
+ if (!_pictures.isEmpty()) {
HSLFPictureData prev = _pictures.get(_pictures.size() - 1);
offset = prev.getOffset() + prev.getBseSize();
}
ByteChunk htmlBodyBinaryChunk = mainChunks.getHtmlBodyChunkBinary();
if (htmlBodyBinaryChunk != null) {
List<PropertyValue> cpid = mainChunks.getProperties().get(MAPIProperty.INTERNET_CPID);
- if (cpid != null && cpid.size() > 0) {
+ if (cpid != null && !cpid.isEmpty()) {
int codepage = ((LongPropertyValue) cpid.get(0)).getValue();
try {
String encoding = CodePageUtil.codepageToEncoding(codepage, true);
// General codepage: Message codepage property.
//
List<PropertyValue> val = mainChunks.getProperties().get(MAPIProperty.MESSAGE_CODEPAGE);
- if (val != null && val.size() > 0) {
+ if (val != null && !val.isEmpty()) {
int codepage = ((LongPropertyValue) val.get(0)).getValue();
try {
String encoding = CodePageUtil.codepageToEncoding(codepage, true);
//
if (generalcodepage == null) {
val = mainChunks.getProperties().get(MAPIProperty.MESSAGE_LOCALE_ID);
- if (val != null && val.size() > 0) {
+ if (val != null && !val.isEmpty()) {
int lcid = ((LongPropertyValue) val.get(0)).getValue();
int codepage = LocaleUtil.getDefaultCodePageFromLCID(lcid);
try {
// UTF-8 is ignored for text body. This seems to be a special Outlook behavior.
//
val = mainChunks.getProperties().get(MAPIProperty.INTERNET_CPID);
- if (val != null && val.size() > 0) {
+ if (val != null && !val.isEmpty()) {
int codepage = ((LongPropertyValue) val.get(0)).getValue();
try {
String encoding = CodePageUtil.codepageToEncoding(codepage, true);
MAPIProperty.CREATION_TIME
}) {
List<PropertyValue> val = mainChunks.getProperties().get(prop);
- if (val != null && val.size() > 0) {
+ if (val != null && !val.isEmpty()) {
return ((TimePropertyValue)val.get(0)).getValue();
}
}
} else if(r instanceof SeriesTextRecord) {
// Applies to a series, unless we've seen a legend already
SeriesTextRecord str = (SeriesTextRecord)r;
- if(lastChart.legendRecord == null && lastChart.series.size() > 0) {
+ if(lastChart.legendRecord == null && !lastChart.series.isEmpty()) {
HSSFSeries series = lastChart.series.get(lastChart.series.size()-1);
series.seriesTitleText = str;
} else {
}
}
- if (_rows.size() > 0) {
+ if (!_rows.isEmpty()) {
Integer key = Integer.valueOf(row.getRowNum());
HSSFRow removedRow = _rows.remove(key);
if (removedRow != row) {
*/
protected void preWrite()
{
- if (_children.size() > 0)
+ if (!_children.isEmpty())
{
Property[] children = _children.toArray(new Property[ 0 ]);
first = false;
}
}
- if (fractionalSpecials.size() > 0) {
+ if (!fractionalSpecials.isEmpty()) {
fmtBuf.append('.');
for (Special s : fractionalSpecials) {
if (isDigitFmt(s)) {
private void writeFractional(StringBuffer result, StringBuffer output) {
int digit;
int strip;
- if (fractionalSpecials.size() > 0) {
+ if (!fractionalSpecials.isEmpty()) {
String decimalSeparator = Character.toString(getDecimalFormatSymbols().getDecimalSeparator());
digit = result.indexOf(decimalSeparator) + 1;
if (exponent != null) {
// See comment in writeScientific -- exponent handling is complex.
// (1) When parsing the format, remove the sign from after the 'e' and
// put it before the first digit of the exponent.
- if (exponent == null && specials.size() > 0) {
+ if (exponent == null && !specials.isEmpty()) {
exponent = new Special('.', pos);
specials.add(exponent);
insertSignForExponent = part.charAt(1);
break;
case '.':
- if (decimalPoint == null && specials.size() > 0) {
+ if (decimalPoint == null && !specials.isEmpty()) {
decimalPoint = new Special('.', pos);
specials.add(decimalPoint);
}
dis.reset();
}
}
- assertTrue(props.size() > 0);
+ assertFalse(props.isEmpty());
}
}
return count;