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 2025/09/08 09:56:39 UTC

svn commit: r1928282 - pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser

Author: tilman
Date: Mon Sep  8 09:56:39 2025
New Revision: 1928282

Log:
PDFBOX-6064: improve logging, fix typo

Modified:
   pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java	Mon Sep  8 09:56:35 2025	(r1928281)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java	Mon Sep  8 09:56:39 2025	(r1928282)
@@ -53,6 +53,7 @@ public class PDFStreamParser extends Bas
     private static final int MAX_BIN_CHAR_TEST_LENGTH = 10;
     private final byte[] binCharTestArr = new byte[MAX_BIN_CHAR_TEST_LENGTH];
     private int inlineImageDepth = 0;
+    private long inlineOffset = 0;
     
     /**
      * Constructor.
@@ -280,7 +281,12 @@ public class PDFStreamParser extends Bas
                     if (inlineImageDepth > 1)
                     {
                         // PDFBOX-6038
-                        throw new IOException("Nested '" + OperatorName.BEGIN_INLINE_IMAGE + "' operator not allowed");
+                        throw new IOException("Nested '" + OperatorName.BEGIN_INLINE_IMAGE +
+                                "' operator not allowed at offset " + seqSource.getPosition() + ", first: " + inlineOffset);
+                    }
+                    else
+                    {
+                        inlineOffset = seqSource.getPosition();
                     }
                     COSDictionary imageParams = new COSDictionary();
                     beginImageOP.setImageParameters(imageParams);
@@ -309,6 +315,11 @@ public class PDFStreamParser extends Bas
                         }
                         beginImageOP.setImageData(imageData.getImageData());
                     }
+                    else
+                    {
+                        LOG.warn("nextToken " + nextToken + " at position " + seqSource.getPosition() +
+                                ", expected " + OperatorName.BEGIN_INLINE_IMAGE_DATA + "?!");
+                    }
                 }
                 return beginImageOP;
             case 'I':
@@ -416,7 +427,7 @@ public class PDFStreamParser extends Bas
                 if (!"Q".equals(s) && !"EMC".equals(s) && !"S".equals(s) &&
                     !s.matches("^\\d*\\.?\\d*$"))
                 {
-                    // operator is not Q, not EMC, not S, nur a number -> assume binary data
+                    // operator is not Q, not EMC, not S, nor a number -> assume binary data
                     noBinData = false;
                 }
             }