Author: tilman
Date: Mon Sep  8 09:56:43 2025
New Revision: 1928283

Log:
PDFBOX-6064: improve logging, fix typo

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

Modified: 
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
==============================================================================
--- 
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
   Mon Sep  8 09:56:39 2025        (r1928282)
+++ 
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
   Mon Sep  8 09:56:43 2025        (r1928283)
@@ -49,6 +49,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.
@@ -241,7 +242,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 " + 
source.getPosition() + ", first: " + inlineOffset);
+                    }
+                    else
+                    {
+                        inlineOffset = source.getPosition();
                     }
                     COSDictionary imageParams = new COSDictionary();
                     beginImageOP.setImageParameters( imageParams );
@@ -268,6 +274,11 @@ public class PDFStreamParser extends Bas
                         beginImageOP.setImageData(imageData.getImageData());
                         inlineImageDepth--;
                     }
+                    else
+                    {
+                        LOG.warn("nextToken " + nextToken + " at position " + 
source.getPosition() +
+                                ", expected " + 
OperatorName.BEGIN_INLINE_IMAGE_DATA + "?!");
+                    }
                 }
                 return beginImageOP;
             case 'I':
@@ -376,7 +387,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;
                 }
             }

Reply via email to