You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2019/10/10 17:11:23 UTC

svn commit: r1868260 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/io/ScratchFile.java

Author: tilman
Date: Thu Oct 10 17:11:23 2019
New Revision: 1868260

URL: http://svn.apache.org/viewvc?rev=1868260&view=rev
Log:
PDFBOX-4601: log only if enabled, in case ".length()" makes it slower

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/io/ScratchFile.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/io/ScratchFile.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/io/ScratchFile.java?rev=1868260&r1=1868259&r2=1868260&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/io/ScratchFile.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/io/ScratchFile.java Thu Oct 10 17:11:23 2019
@@ -241,12 +241,20 @@ public class ScratchFile implements Clos
                 // enlarge if we do not int overflow
                 if (pageCount + ENLARGE_PAGE_COUNT > pageCount)
                 {
-                    LOG.debug("file: " + file);
-                    LOG.debug("fileLen before: " + fileLen + ", raf length: " + raf.length() + ", file length: " + file.length());
+                    if (LOG.isDebugEnabled())
+                    {
+                        LOG.debug("file: " + file);
+                        LOG.debug("fileLen before: " + fileLen + ", raf length: " + raf.length() + 
+                                  ", file length: " + file.length());
+                    }
                     fileLen += ENLARGE_PAGE_COUNT * PAGE_SIZE;
 
                     raf.setLength(fileLen);
-                    LOG.debug("fileLen after1:  " + fileLen + ", raf length: " + raf.length() + ", file length: " + file.length());
+                    if (LOG.isDebugEnabled())
+                    {
+                        LOG.debug("fileLen after1: " + fileLen + ", raf length: " + raf.length() + 
+                                  ", file length: " + file.length());
+                    }
                     if (fileLen != raf.length() || fileLen != file.length())
                     {
                         // PDFBOX-4601 possible AWS lambda bug that setLength() doesn't throw