diff options
author | PJ Fanning <fanningpj@apache.org> | 2020-12-17 21:42:19 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2020-12-17 21:42:19 +0000 |
commit | bd1d31e410f1ec6bd589e985216167b749158dfd (patch) | |
tree | 2840563849a4d4ee10b45dd7e164ccf003076ed5 /src/java | |
parent | 0e0d1d56da7d3ad69e80dae199a7f9741b385bb9 (diff) | |
download | poi-bd1d31e410f1ec6bd589e985216167b749158dfd.tar.gz poi-bd1d31e410f1ec6bd589e985216167b749158dfd.zip |
avoid string concats
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1884573 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
7 files changed, 15 insertions, 21 deletions
diff --git a/src/java/org/apache/poi/hssf/model/InternalSheet.java b/src/java/org/apache/poi/hssf/model/InternalSheet.java index 1240ae7b19..c28dbee408 100644 --- a/src/java/org/apache/poi/hssf/model/InternalSheet.java +++ b/src/java/org/apache/poi/hssf/model/InternalSheet.java @@ -400,12 +400,12 @@ public final class InternalSheet { public static InternalSheet createSheet() { return new InternalSheet(); } + private InternalSheet() { _mergedCellsTable = new MergedCellsTable(); List<RecordBase> records = new ArrayList<>(32); - if (log.check( POILogger.DEBUG )) - log.log(POILogger.DEBUG, "Sheet createsheet from scratch called"); + log.log(POILogger.DEBUG, "Sheet createsheet from scratch called"); records.add(createBOF()); @@ -452,8 +452,7 @@ public final class InternalSheet { records.add(EOFRecord.instance); _records = records; - if (log.check( POILogger.DEBUG )) - log.log(POILogger.DEBUG, "Sheet createsheet from scratch exit"); + log.log(POILogger.DEBUG, "Sheet createsheet from scratch exit"); } public RowRecordsAggregate getRowsAggregate() { @@ -551,8 +550,7 @@ public final class InternalSheet { _dimensions.setFirstRow(firstrow); _dimensions.setLastCol(lastcol); _dimensions.setLastRow(lastrow); - if (log.check( POILogger.DEBUG )) - log.log(POILogger.DEBUG, "Sheet.setDimensions exiting"); + log.log(POILogger.DEBUG, "Sheet.setDimensions exiting"); } public void visitContainedRecords(RecordVisitor rv, int offset) { diff --git a/src/java/org/apache/poi/hssf/record/common/ExtRst.java b/src/java/org/apache/poi/hssf/record/common/ExtRst.java index 50f41dedae..17df9df3f4 100644 --- a/src/java/org/apache/poi/hssf/record/common/ExtRst.java +++ b/src/java/org/apache/poi/hssf/record/common/ExtRst.java @@ -78,7 +78,7 @@ public class ExtRst implements Comparable<ExtRst>, GenericRecord { // Spot corrupt records if(reserved != 1) { - _logger.log(POILogger.WARN, "Warning - ExtRst has wrong magic marker, expecting 1 but found " + reserved + " - ignoring"); + _logger.log(POILogger.WARN, "Warning - ExtRst has wrong magic marker, expecting 1 but found ", reserved, " - ignoring"); // Grab all the remaining data, and ignore it for(int i=0; i<expectedLength-2; i++) { in.readByte(); @@ -121,7 +121,7 @@ public class ExtRst implements Comparable<ExtRst>, GenericRecord { int extraDataLength = runData - (numRuns*6); if(extraDataLength < 0) { - _logger.log( POILogger.WARN, "Warning - ExtRst overran by " + (0-extraDataLength) + " bytes"); + _logger.log( POILogger.WARN, "Warning - ExtRst overran by ", (0-extraDataLength), " bytes"); extraDataLength = 0; } extraData = IOUtils.safelyAllocate(extraDataLength, MAX_RECORD_LENGTH); diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java index b570a68c47..aaf9a431b5 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java @@ -231,9 +231,9 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet { } if (log.check( POILogger.DEBUG )) { if (cval instanceof Record) { - log.log( DEBUG, "record id = " + Integer.toHexString( ( (org.apache.poi.hssf.record.Record) cval ).getSid() ) ); + log.log( DEBUG, "record id = ", Integer.toHexString( ( (org.apache.poi.hssf.record.Record) cval ).getSid() ) ); } else { - log.log( DEBUG, "record = " + cval ); + log.log( DEBUG, "record = ", cval ); } } hrow.createCellFromRecord( cval ); diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java index 9fd9b96bd6..0b9f60facf 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java @@ -427,9 +427,7 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss */ private void convertLabelRecords(List<org.apache.poi.hssf.record.Record> records, int offset) { - if (log.check(POILogger.DEBUG)) { - log.log(POILogger.DEBUG, "convertLabelRecords called"); - } + log.log(POILogger.DEBUG, "convertLabelRecords called"); for (int k = offset; k < records.size(); k++) { Record rec = records.get(k); @@ -448,9 +446,7 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss records.add(k, newrec); } } - if (log.check(POILogger.DEBUG)) { - log.log(POILogger.DEBUG, "convertLabelRecords exit"); - } + log.log(POILogger.DEBUG, "convertLabelRecords exit"); } /** diff --git a/src/java/org/apache/poi/sl/draw/DrawPictureShape.java b/src/java/org/apache/poi/sl/draw/DrawPictureShape.java index 2e25d75a6a..933211658a 100644 --- a/src/java/org/apache/poi/sl/draw/DrawPictureShape.java +++ b/src/java/org/apache/poi/sl/draw/DrawPictureShape.java @@ -93,8 +93,8 @@ public class DrawPictureShape extends DrawSimpleShape { // the fallback is the BitmapImageRenderer, at least it gracefully handles invalid images final Supplier<ImageRenderer> getFallback = () -> { - LOG.log(POILogger.WARN, "No suitable image renderer found for content-type '"+ - contentType+"' - include poi-scratchpad (for wmf/emf) or poi-ooxml (for svg) jars!"); + LOG.log(POILogger.WARN, "No suitable image renderer found for content-type '", + contentType, "' - include poi-scratchpad (for wmf/emf) or poi-ooxml (for svg) jars!"); return fallback; }; diff --git a/src/java/org/apache/poi/ss/formula/constant/ErrorConstant.java b/src/java/org/apache/poi/ss/formula/constant/ErrorConstant.java index b39c322331..35c608ac0b 100644 --- a/src/java/org/apache/poi/ss/formula/constant/ErrorConstant.java +++ b/src/java/org/apache/poi/ss/formula/constant/ErrorConstant.java @@ -66,7 +66,7 @@ public class ErrorConstant { default: break; } } - logger.log( POILogger.WARN, "Warning - unexpected error code (" + errorCode + ")"); + logger.log( POILogger.WARN, "Warning - unexpected error code (", errorCode, ")"); return new ErrorConstant(errorCode); } diff --git a/src/java/org/apache/poi/ss/usermodel/DataFormatter.java b/src/java/org/apache/poi/ss/usermodel/DataFormatter.java index 5f383776b7..10e989e5c5 100644 --- a/src/java/org/apache/poi/ss/usermodel/DataFormatter.java +++ b/src/java/org/apache/poi/ss/usermodel/DataFormatter.java @@ -598,7 +598,7 @@ public class DataFormatter { try { return new ExcelStyleDateFormatter(formatStr, dateSymbols); } catch(IllegalArgumentException iae) { - logger.log(POILogger.DEBUG, "Formatting failed for format " + formatStr + ", falling back", iae); + logger.log(POILogger.DEBUG, "Formatting failed for format ", formatStr, ", falling back", iae); // the pattern could not be parsed correctly, // so fall back to the default number format return getDefaultFormat(cellValue); @@ -758,7 +758,7 @@ public class DataFormatter { try { return new InternalDecimalFormatWithScale(format, symbols); } catch(IllegalArgumentException iae) { - logger.log(POILogger.DEBUG, "Formatting failed for format " + formatStr + ", falling back", iae); + logger.log(POILogger.DEBUG, "Formatting failed for format ", formatStr, ", falling back", iae); // the pattern could not be parsed correctly, // so fall back to the default number format return getDefaultFormat(cellValue); |