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 2014/07/04 17:57:22 UTC
svn commit: r1607884 -
/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java
Author: tilman
Date: Fri Jul 4 15:57:21 2014
New Revision: 1607884
URL: http://svn.apache.org/r1607884
Log:
PDFBOX-2186: allow tab in xref lines, minor cleanup
Modified:
pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java
Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java?rev=1607884&r1=1607883&r2=1607884&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java Fri Jul 4 15:57:21 2014
@@ -549,8 +549,8 @@ public class PDFParser extends BaseParse
else
{
long number = -1;
- int genNum = -1;
- String objectKey = null;
+ int genNum;
+ String objectKey;
boolean missingObjectNumber = false;
try
{
@@ -769,7 +769,7 @@ public class PDFParser extends BaseParse
}
//Ignore table contents
String currentLine = readLine();
- String[] splitString = currentLine.split(" ");
+ String[] splitString = currentLine.split("\\s");
if (splitString.length < 3)
{
LOG.warn("invalid xref line: " + currentLine);
@@ -907,16 +907,17 @@ public class PDFParser extends BaseParse
private static class ConflictObj
{
- private long offset;
- private COSObjectKey objectKey;
- private COSObject object;
+ private final long offset;
+ private final COSObjectKey objectKey;
+ private final COSObject object;
- public ConflictObj(long offsetValue, COSObjectKey key, COSObject pdfObject)
+ ConflictObj(long offsetValue, COSObjectKey key, COSObject pdfObject)
{
this.offset = offsetValue;
this.objectKey = key;
this.object = pdfObject;
}
+
@Override
public String toString()
{
@@ -940,8 +941,7 @@ public class PDFParser extends BaseParse
do
{
ConflictObj o = conflicts.next();
- Long offset = new Long(o.offset);
- if (tolerantConflicResolver(values, offset, 4))
+ if (tolerantConflicResolver(values, o.offset, 4))
{
COSObject pdfObject = document.getObjectFromPool(o.objectKey);
if (pdfObject.getObjectNumber() != null
@@ -951,7 +951,7 @@ public class PDFParser extends BaseParse
}
else
{
- LOG.debug("Conflict object ["+o.objectKey+"] at offset "+offset
+ LOG.debug("Conflict object [" + o.objectKey + "] at offset " + o.offset
+" found in the xref table, but the object numbers differ. Ignoring this object."
+ " The document is maybe malformed.");
}