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 2020/06/17 15:47:32 UTC

svn commit: r1878931 - /pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/BufferedRandomAccessFile.java

Author: tilman
Date: Wed Jun 17 15:47:31 2020
New Revision: 1878931

URL: http://svn.apache.org/viewvc?rev=1878931&view=rev
Log:
PDFBOX-4890: add debug logging

Modified:
    pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/BufferedRandomAccessFile.java

Modified: pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/BufferedRandomAccessFile.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/BufferedRandomAccessFile.java?rev=1878931&r1=1878930&r2=1878931&view=diff
==============================================================================
--- pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/BufferedRandomAccessFile.java (original)
+++ pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/BufferedRandomAccessFile.java Wed Jun 17 15:47:31 2020
@@ -19,6 +19,8 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.RandomAccessFile;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * This class is a version of the one published at
@@ -33,6 +35,8 @@ import java.io.RandomAccessFile;
  */
 public class BufferedRandomAccessFile extends RandomAccessFile
 {
+    private static final Log LOG = LogFactory.getLog(BufferedRandomAccessFile.class);
+
     /**
      * Uses a byte instead of a char buffer for efficiency reasons.
      */
@@ -66,6 +70,7 @@ public class BufferedRandomAccessFile ex
             throws FileNotFoundException
     {
         super(filename, mode);
+LOG.debug("filename: " + filename);
         BUFSIZE = bufsize;
         buffer = new byte[BUFSIZE];
     }
@@ -86,6 +91,7 @@ public class BufferedRandomAccessFile ex
             throws FileNotFoundException
     {
         super(file, mode);
+LOG.debug("file: " + file);
         BUFSIZE = bufsize;
         buffer = new byte[BUFSIZE];
     }
@@ -148,6 +154,7 @@ public class BufferedRandomAccessFile ex
     @Override
     public int read(byte[] b, int off, int len) throws IOException
     {
+LOG.debug("b size: " + b.length + ", off: " + off + ", len: " + len);
         int leftover = bufend - bufpos;
         if (len <= leftover)
         {
@@ -159,7 +166,9 @@ public class BufferedRandomAccessFile ex
         bufpos += leftover;
         if (fillBuffer() > 0)
         {
+LOG.debug("leftover: " + leftover);
             int bytesRead = read(b, off + leftover, len - leftover);
+LOG.debug("bytesRead: " + bytesRead);
             if (bytesRead > 0)
             {
                 leftover += bytesRead;