You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ad...@apache.org on 2011/03/16 17:39:12 UTC
svn commit: r1082193 -
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java
Author: adam
Date: Wed Mar 16 16:39:12 2011
New Revision: 1082193
URL: http://svn.apache.org/viewvc?rev=1082193&view=rev
Log:
PDFBOX-979: errors in %%EOF handling
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java?rev=1082193&r1=1082192&r2=1082193&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java Wed Mar 16 16:39:12 2011
@@ -466,15 +466,17 @@ public class PDFParser extends BaseParse
pdfSource.read(); // read (get rid of) all the whitespace
String eof = "";
if(!pdfSource.isEOF())
- readLine(); // if there's more data to read, get the EOF flag
+ eof = readLine(); // if there's more data to read, get the EOF flag
// verify that EOF exists
- if("%%EOF".equals(eof)) {
+ if(!"%%EOF".equals(eof)) {
// PDF does not conform to spec, we should warn someone
log.warn("expected='%%EOF' actual='" + eof + "'");
// if we're not at the end of a file, just put it back and move on
- if(!pdfSource.isEOF())
+ if(!pdfSource.isEOF()) {
pdfSource.unread(eof.getBytes("ISO-8859-1"));
+ pdfSource.unread( SPACE_BYTE ); // we read a whole line; add space as newline replacement
+ }
}
isEndOfFile = true;
}