You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2021/05/09 10:47:00 UTC
svn commit: r1889696 -
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
Author: lehmi
Date: Sun May 9 10:46:59 2021
New Revision: 1889696
URL: http://svn.apache.org/viewvc?rev=1889696&view=rev
Log:
PDFBOX-4892: remove unneeded else statement
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java?rev=1889696&r1=1889695&r2=1889696&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java Sun May 9 10:46:59 2021
@@ -847,31 +847,27 @@ public abstract class BaseParser
{
return parseCOSNumber();
}
- else
+ // This is not suppose to happen, but we will allow for it
+ // so we are more compatible with POS writers that don't
+ // follow the spec
+ String badString = readString();
+ if (badString.isEmpty())
{
- //This is not suppose to happen, but we will allow for it
- //so we are more compatible with POS writers that don't
- //follow the spec
- String badString = readString();
- if (badString.isEmpty())
- {
- int peek = source.peek();
- // we can end up in an infinite loop otherwise
- throw new IOException( "Unknown dir object c='" + c +
- "' cInt=" + (int)c + " peek='" + (char)peek
- + "' peekInt=" + peek + " at offset " + source.getPosition());
- }
+ int peek = source.peek();
+ // we can end up in an infinite loop otherwise
+ throw new IOException("Unknown dir object c='" + c + "' cInt=" + (int) c + " peek='"
+ + (char) peek + "' peekInt=" + peek + " at offset " + source.getPosition());
+ }
- // if it's an endstream/endobj, we want to put it back so the caller will see it
- if(ENDOBJ_STRING.equals(badString) || ENDSTREAM_STRING.equals(badString))
- {
- source.rewind(badString.getBytes(StandardCharsets.ISO_8859_1).length);
- }
- else
- {
- LOG.warn("Skipped unexpected dir object = '" + badString + "' at offset "
- + source.getPosition());
- }
+ // if it's an endstream/endobj, we want to put it back so the caller will see it
+ if (ENDOBJ_STRING.equals(badString) || ENDSTREAM_STRING.equals(badString))
+ {
+ source.rewind(badString.getBytes(StandardCharsets.ISO_8859_1).length);
+ }
+ else
+ {
+ LOG.warn("Skipped unexpected dir object = '" + badString + "' at offset "
+ + source.getPosition());
}
}
return null;