Skip to content

Commit a8a85be

Browse files
committed
PDFBOX-6064: improve logging, fix typo
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1928281 13f79535-47bb-0310-9956-ffa450edef68
1 parent 2b8bdd7 commit a8a85be

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class PDFStreamParser extends BaseParser
4949
private static final int MAX_BIN_CHAR_TEST_LENGTH = 10;
5050
private final byte[] binCharTestArr = new byte[MAX_BIN_CHAR_TEST_LENGTH];
5151
private int inlineImageDepth = 0;
52+
private long inlineOffset = 0;
5253

5354
/**
5455
* Constructor.
@@ -241,7 +242,12 @@ else if( next.equals( "false" ) )
241242
if (inlineImageDepth > 1)
242243
{
243244
// PDFBOX-6038
244-
throw new IOException("Nested '" + OperatorName.BEGIN_INLINE_IMAGE + "' operator not allowed");
245+
throw new IOException("Nested '" + OperatorName.BEGIN_INLINE_IMAGE +
246+
"' operator not allowed at offset " + source.getPosition() + ", first: " + inlineOffset);
247+
}
248+
else
249+
{
250+
inlineOffset = source.getPosition();
245251
}
246252
COSDictionary imageParams = new COSDictionary();
247253
beginImageOP.setImageParameters( imageParams );
@@ -269,6 +275,11 @@ else if( next.equals( "false" ) )
269275
beginImageOP.setImageData(imageData.getImageData());
270276
inlineImageDepth--;
271277
}
278+
else
279+
{
280+
LOG.warn("nextToken {} at position {}, expected {}?!",
281+
nextToken, source.getPosition(), OperatorName.BEGIN_INLINE_IMAGE_DATA);
282+
}
272283
}
273284
return beginImageOP;
274285
case 'I':
@@ -379,7 +390,7 @@ else if (startOpIdx != -1 && endOpIdx == -1 &&
379390
if (!"Q".equals(s) && !"EMC".equals(s) && !"S".equals(s) &&
380391
!s.matches("^\\d*\\.?\\d*$"))
381392
{
382-
// operator is not Q, not EMC, not S, nur a number -> assume binary data
393+
// operator is not Q, not EMC, not S, nor a number -> assume binary data
383394
noBinData = false;
384395
}
385396
}

0 commit comments

Comments
 (0)