]> source.dussan.org Git - poi.git/commitdiff
avoid string concats
authorPJ Fanning <fanningpj@apache.org>
Thu, 17 Dec 2020 21:54:42 +0000 (21:54 +0000)
committerPJ Fanning <fanningpj@apache.org>
Thu, 17 Dec 2020 21:54:42 +0000 (21:54 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1884574 13f79535-47bb-0310-9956-ffa450edef68

17 files changed:
src/examples/src/org/apache/poi/examples/hssf/usermodel/Outlines.java
src/java/org/apache/poi/hssf/record/FormatRecord.java
src/java/org/apache/poi/hssf/record/LabelRecord.java
src/java/org/apache/poi/hssf/record/OldLabelRecord.java
src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
src/java/org/apache/poi/ss/util/CellUtil.java
src/java/org/apache/poi/util/POILogger.java
src/ooxml/java/org/apache/poi/poifs/crypt/temp/SXSSFWorkbookWithCustomZipEntrySource.java
src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFFormulaEvaluator.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheetMergeRegions.java
src/scratchpad/src/org/apache/poi/hdgf/chunks/Chunk.java
src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfComment.java
src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java
src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java
src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordUtils.java
src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmUncompressor.java

index d059a3d3923226b7eeffbc04dc58ed0b30613476..b5121448c43ba3950efe6f66ecc8272194bf7966 100644 (file)
@@ -41,7 +41,7 @@ public class Outlines implements Closeable {
                 String log = (String) Outlines.class.getDeclaredMethod("test" + i).invoke(o);
                 String filename = "outline" + i + ".xls";
                 o.writeOut(filename);
-                LOGGER.log(POILogger.INFO, filename + " written. " + log);
+                LOGGER.log(POILogger.INFO, filename, " written. ", log);
             }
         }
     }
index 4eb4aeb56eead0e38dba15c528ae510cd8923024..a08268d32c6e478dee137ba042d2e26cc3133bb1 100644 (file)
@@ -149,7 +149,7 @@ public final class FormatRecord extends StandardRecord {
         }
 
         if (ris.available() > 0) {
-            logger.log(POILogger.INFO, "FormatRecord has "+ris.available()+" unexplained bytes. Silently skipping");
+            logger.log(POILogger.INFO, "FormatRecord has ", ris.available(), " unexplained bytes. Silently skipping");
             //swallow what's left
             while (ris.available() > 0) {
                 ris.readByte();
index 9683c86e4cf6f156a5e3ee0969e96f8951369787..ea201812201453bda1b8ee1734ccb673730bc27b 100644 (file)
@@ -78,8 +78,8 @@ public final class LabelRecord extends Record implements CellValueRecordInterfac
 
         if (in.remaining() > 0) {
            logger.log(POILogger.INFO,
-                   "LabelRecord data remains: " + in.remaining() +
-                           " : " + HexDump.toHex(in.readRemainder())
+                   "LabelRecord data remains: ", in.remaining(),
+                           " : ", HexDump.toHex(in.readRemainder())
            );
         }
     }
index 8a4697ff127c1f1548019010c759addcd8a04178..dc3822c3e1ae105ce2bb1f2737bead4c29d17b41 100644 (file)
@@ -63,8 +63,8 @@ public final class OldLabelRecord extends OldCellRecord {
 
         if (in.remaining() > 0) {
             logger.log(POILogger.INFO,
-                    "LabelRecord data remains: " + in.remaining() +
-                    " : " + HexDump.toHex(in.readRemainder())
+                    "LabelRecord data remains: ", in.remaining(),
+                    " : ", HexDump.toHex(in.readRemainder())
                     );
         }
     }
index 77d0937876eccd370e8af9d8cedd7d240f4c06f4..fa8dec334ba3c3734c26b614d11da1352d527a7a 100644 (file)
@@ -406,7 +406,7 @@ public final class WorkbookEvaluator {
             // since we don't know how to handle these yet :(
             Ptg ptg = ptgs[i];
             if (dbgEvaluationOutputIndent > 0) {
-                EVAL_LOG.log(POILogger.INFO, dbgIndentStr + "  * ptg " + i + ": " + ptg + ", stack: " + stack);
+                EVAL_LOG.log(POILogger.INFO, dbgIndentStr, "  * ptg ", i, ": ", ptg, ", stack: ", stack);
             }
             if (ptg instanceof AttrPtg) {
                 AttrPtg attrPtg = (AttrPtg) ptg;
@@ -551,7 +551,7 @@ public final class WorkbookEvaluator {
 //            logDebug("push " + opResult);
             stack.push(opResult);
             if (dbgEvaluationOutputIndent > 0) {
-                EVAL_LOG.log(POILogger.INFO, dbgIndentStr + "    = " + opResult);
+                EVAL_LOG.log(POILogger.INFO, dbgIndentStr, "    = ", opResult);
             }
         }
 
@@ -570,9 +570,9 @@ public final class WorkbookEvaluator {
         }
 
         if (dbgEvaluationOutputIndent > 0) {
-            EVAL_LOG.log(POILogger.INFO, dbgIndentStr + "finshed eval of "
-                            + new CellReference(ec.getRowIndex(), ec.getColumnIndex()).formatAsString()
-                            + ": " + result);
+            EVAL_LOG.log(POILogger.INFO, dbgIndentStr, "finished eval of ",
+                            new CellReference(ec.getRowIndex(), ec.getColumnIndex()).formatAsString(),
+                            ": ", result);
             dbgEvaluationOutputIndent--;
             if (dbgEvaluationOutputIndent == 1) {
                 // this evaluation is done, reset indent to stop logging
index dfbbf04481c790908dd0749570082bf9f5b55f01..67823b5494b2c7f95851ed123cdcc69695998a5a 100644 (file)
@@ -385,9 +385,7 @@ public final class CellUtil {
             } else if (FILL_PATTERN.equals(key)) {
                 dest.put(key, getFillPattern(src, key));
             } else {
-                if (log.check(POILogger.INFO)) {
-                    log.log(POILogger.INFO, "Ignoring unrecognized CellUtil format properties key: " + key);
-                }
+                log.log(POILogger.INFO, "Ignoring unrecognized CellUtil format properties key: ", key);
             }
         }
     }
index fa52baabd518f71c3f1fe375e975d2fe72c17690..7a7e9ee135ef3acdd6ee2bc221290b710208a948 100644 (file)
@@ -79,7 +79,7 @@ public interface POILogger {
      * An example:
      * <code><pre>
      * if (logger.check(POILogger.INFO)) {
-     *     logger.log(POILogger.INFO, "Avoid concatenating " + " strings and evaluating " + functions());
+     *     logger.log(POILogger.INFO, "Avoid concatenating ", " strings and evaluating ", functions());
      * }
      * </pre></code>
      *
index 59e4ff5b99f909d5f94e945221be4e92a30a6444..01a0b21e181ec675f57944417f632e99a5caa8e1 100644 (file)
@@ -60,8 +60,8 @@ public class SXSSFWorkbookWithCustomZipEntrySource extends SXSSFWorkbook {
     @Override
     protected SheetDataWriter createSheetDataWriter() throws IOException {
         //log values to ensure these values are accessible to subclasses
-        LOG.log(POILogger.INFO, "isCompressTempFiles: " + isCompressTempFiles());
-        LOG.log(POILogger.INFO, "SharedStringSource: " + getSharedStringSource());
+        LOG.log(POILogger.INFO, "isCompressTempFiles: ", isCompressTempFiles());
+        LOG.log(POILogger.INFO, "SharedStringSource: ", getSharedStringSource());
         return new SheetDataWriterWithDecorator();
     }
 }
index 69f704ef788a902838831fbf395eb14fc0239694..7b8526d7e0d146e8b904d58b0ade1b8cd8d28154 100644 (file)
@@ -111,7 +111,7 @@ public final class SXSSFFormulaEvaluator extends BaseXSSFFormulaEvaluator {
                 int lastFlushedRowNum = ((SXSSFSheet) sheet).getLastFlushedRowNum();
                 if (lastFlushedRowNum > -1) {
                     if (! skipOutOfWindow) throw new RowFlushedException(0);
-                    logger.log(POILogger.INFO, "Rows up to " + lastFlushedRowNum + " have already been flushed, skipping");
+                    logger.log(POILogger.INFO, "Rows up to ", lastFlushedRowNum, " have already been flushed, skipping");
                 }
             }
             
index 667b4ff5dc36dfa7b7fbd6c358076549c1bc5689..c2807845536af88ad89394e75333560d2aaf4dd5 100644 (file)
@@ -3549,14 +3549,14 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
             LOG.log(POILogger.INFO, "Autosizing columns...");
 
             for (int i = 0; i < 3; ++i) {
-                LOG.log(POILogger.INFO, "Autosize " + i + " - " + Duration.between(start, Instant.now()));
+                LOG.log(POILogger.INFO, "Autosize ", i, " - ", Duration.between(start, Instant.now()));
                 sheet.autoSizeColumn(i);
             }
 
             for (int i = 0; i < 69 - 35 + 1; ++i)
                 for (int j = 0; j < 8; ++j) {
                     int col = 3 + 2 + i * (8 + 2) + j;
-                    LOG.log(POILogger.INFO, "Autosize " + col + " - " + Duration.between(start, Instant.now()));
+                    LOG.log(POILogger.INFO, "Autosize ", col, " - ", Duration.between(start, Instant.now()));
                     sheet.autoSizeColumn(col);
                 }
             LOG.log(POILogger.INFO, Duration.between(start, Instant.now()));
index f4a4ed03199ded17b0d2d0f9434f754fb9465b5c..4f2779d97b0d00abb9391b505c781bfb52735819 100644 (file)
@@ -43,7 +43,7 @@ public class TestXSSFSheetMergeRegions {
                 if (millis < 2000) {
                     break;
                 }
-                LOG.log(POILogger.INFO, "Retry " + i + " because run-time is too high: " + millis);
+                LOG.log(POILogger.INFO, "Retry ", i, " because run-time is too high: ", millis);
             }
 
             boolean inGump = false;
index 49bd462fdcb013b65016e0944feaa457e981cf6a..9c1716b571962b2799f85332592bdd9fc7096f24 100644 (file)
@@ -242,12 +242,11 @@ public final class Chunk {
 
                 default:
                     logger.log(POILogger.INFO,
-                            "Command of type " + type + " not processed!");
+                            "Command of type ", type, " not processed!");
                 }
             }
             catch (Exception e) {
-                logger.log(POILogger.ERROR, "Unexpected error processing command, ignoring and continuing. Command: " +
-                        command, e);
+                logger.log(POILogger.ERROR, "Unexpected error processing command, ignoring and continuing. Command: ", command, e);
             }
 
             // Add to the array
index 83e8db759881101a41998071e911763846f819b8..2590fd85b99f296889244ab273c0cabbd3c8d93f 100644 (file)
@@ -601,8 +601,8 @@ public class HemfComment {
             // some emf comments are truncated, so we don't use readFully here
             int readBytes = leis.read(wmfData);
             if (readBytes < wmfData.length) {
-                logger.log(POILogger.INFO, "Emf comment with WMF: expected "+wmfData.length+
-                        " bytes - received only "+readBytes+" bytes.");
+                logger.log(POILogger.INFO, "Emf comment with WMF: expected ", wmfData.length,
+                        " bytes - received only ", readBytes, " bytes.");
             }
 
             return leis.getReadIndex()-startIdx;
index 6e8c3699a76053589b1070d18ae6b71de92f04ea..fff3764bb49acf28679b58541120d3434aa042ec 100644 (file)
@@ -322,7 +322,7 @@ public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShape<H
     @Override
     public Guide getAdjustValue(String name) {
         if (name == null || !name.matches("adj([1-9]|10)?")) {
-            LOG.log(POILogger.INFO, "Adjust value '"+name+"' not supported. Using default value.");
+            LOG.log(POILogger.INFO, "Adjust value '", name, "' not supported. Using default value.");
             return null;
         }
 
index 7bebedf6ddeb5d282c9169fdfd593eb789ff4775..63e9b6910157d7481ded262dbdece159d8f542d0 100644 (file)
@@ -758,8 +758,8 @@ public final class HSLFSlideShow extends POIDocument implements SlideShow<HSLFSh
 
                // Add in to the list of Slides
                _slides.add(slide);
-               logger.log(POILogger.INFO, "Added slide " + _slides.size() + " with ref " + sp.getRefID()
-                               + " and identifier " + sp.getSlideIdentifier());
+               logger.log(POILogger.INFO, "Added slide ", _slides.size(), " with ref ", sp.getRefID(),
+                               " and identifier ", sp.getSlideIdentifier());
 
                // Add the core records for this new Slide to the record tree
                Slide slideRecord = slide.getSlideRecord();
@@ -1144,7 +1144,7 @@ public final class HSLFSlideShow extends POIDocument implements SlideShow<HSLFSh
                int slideOffset = slideRecord.getLastOnDiskOffset();
                slideRecord.setLastOnDiskOffset(slideOffset);
                ptr.addSlideLookup(psrId, slideOffset);
-               logger.log(POILogger.INFO, "New slide/object ended up at " + slideOffset);
+               logger.log(POILogger.INFO, "New slide/object ended up at ", slideOffset);
 
                return psrId;
     }
index 6ac48d67c1cb888d1d01024a0430a8f5a5153cf3..bfe64868f2442c74ce830e38b10af571026dae7e 100644 (file)
@@ -427,7 +427,7 @@ public class AbstractWordUtils
     {
 
         if ( format != 0 )
-               logger.log( POILogger.INFO, "NYI: toListItemNumberLabel(): " + format );
+               logger.log( POILogger.INFO, "NYI: toListItemNumberLabel(): ", format );
 
         return String.valueOf( number );
     }
index 11072bc3346b85ddba33c8cb79eb68d60d54cc98..ce48874af0abeca36b0bbac427a06d62f85564b3 100644 (file)
@@ -241,7 +241,7 @@ public final class SectionSprmUncompressor extends SprmUncompressor
         newSEP.setNfcEdnRef(sprm.getOperand());
         break;
       default:
-        logger.log(POILogger.INFO, "Unsupported Sprm operation: " + operation + " (" + HexDump.byteToHex(operation) + ")");
+        logger.log(POILogger.INFO, "Unsupported Sprm operation: ", operation, " (", HexDump.byteToHex(operation), ")");
         break;
     }