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 2015/05/03 14:03:11 UTC
svn commit: r1677390 -
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
Author: tilman
Date: Sun May 3 12:03:10 2015
New Revision: 1677390
URL: http://svn.apache.org/r1677390
Log:
PDFBOX-2576: combine if statements
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java?rev=1677390&r1=1677389&r2=1677390&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java Sun May 3 12:03:10 2015
@@ -1062,27 +1062,23 @@ public class COSParser extends BaseParse
// seek to offset-1
pdfSource.seek(startXRefOffset-1);
int nextValue = pdfSource.read();
- // the first character has to be a whitespace
- if (isWhitespace(nextValue))
+ // the first character has to be a whitespace, and then a digit
+ if (isWhitespace(nextValue) && isDigit())
{
- // is the next character a digit?
- if (isDigit())
+ try
{
- try
- {
- // it's a XRef stream
- readObjectNumber();
- readGenerationNumber();
- readExpectedString(OBJ_MARKER, true);
- pdfSource.seek(startXRefOffset);
- return startXRefOffset;
- }
- catch (IOException exception)
- {
- // there wasn't an object of a xref stream
- // try to repair the offset
- pdfSource.seek(startXRefOffset);
- }
+ // it's a XRef stream
+ readObjectNumber();
+ readGenerationNumber();
+ readExpectedString(OBJ_MARKER, true);
+ pdfSource.seek(startXRefOffset);
+ return startXRefOffset;
+ }
+ catch (IOException exception)
+ {
+ // there wasn't an object of a xref stream
+ // try to repair the offset
+ pdfSource.seek(startXRefOffset);
}
}
// try to find a fixed offset