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:24 UTC

svn commit: r1889697 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java

Author: lehmi
Date: Sun May  9 10:47:24 2021
New Revision: 1889697

URL: http://svn.apache.org/viewvc?rev=1889697&view=rev
Log:
PDFBOX-4892: remove unneeded else statement

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

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java?rev=1889697&r1=1889696&r2=1889697&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java Sun May  9 10:47:24 2021
@@ -905,31 +905,28 @@ 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 = seqSource.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 " + seqSource.getPosition() );
-                }
+                int peek = seqSource.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 " + seqSource.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))
-                {
-                    seqSource.unread(badString.getBytes(ISO_8859_1));
-                }
-                else
-                {
-                    LOG.warn("Skipped unexpected dir object = '" + badString + "' at offset "
-                            + seqSource.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))
+            {
+                seqSource.unread(badString.getBytes(ISO_8859_1));
+            }
+            else
+            {
+                LOG.warn("Skipped unexpected dir object = '" + badString + "' at offset "
+                        + seqSource.getPosition());
             }
         }
         return null;