Author: onealj
Date: Mon Jul 10 01:34:30 2017
New Revision: 1801405
URL: http://svn.apache.org/viewvc?rev=1801405&view=rev
Log:
bug 60685: ignore problems with HPBF Publisher Quill Contents PLC hyperlink
records so that text extraction can continue
Added:
poi/trunk/test-data/publisher/60685.pub (with props)
Modified:
poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/model/QuillContents.java
Modified:
poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/model/QuillContents.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/model/QuillContents.java?rev=1801405&r1=1801404&r2=1801405&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/model/QuillContents.java
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/model/QuillContents.java
Mon Jul 10 01:34:30 2017
@@ -26,11 +26,15 @@ import org.apache.poi.hpbf.model.qcbits.
import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LocaleUtil;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
/**
* Read Quill Contents (/Quill/QuillSub/CONTENTS) from an HPBF (Publisher
.pub) document
*/
public final class QuillContents extends HPBFPart {
+ private static POILogger logger =
POILogFactory.getLogger(QuillContents.class);
+
private static final String[] PATH = { "Quill", "QuillSub", "CONTENTS",
};
private QCBit[] bits;
@@ -69,7 +73,13 @@ public final class QuillContents extends
if(bitType.equals("TEXT")) {
bits[i] = new QCTextBit(thingType,
bitType, bitData);
} else if(bitType.equals("PLC ")) {
- bits[i] =
QCPLCBit.createQCPLCBit(thingType, bitType, bitData);
+ try {
+ bits[i] =
QCPLCBit.createQCPLCBit(thingType, bitType, bitData);
+ } catch (ArrayIndexOutOfBoundsException
e) {
+ // bug 60685: fall back so that
the rest of the document can be read
+ logger.log(POILogger.WARN,
"Unable to read Quill Contents PLC Bit record. Ignoring this record.");
+ bits[i] = new
UnknownQCBit(thingType, bitType, bitData);
+ }
} else {
bits[i] = new UnknownQCBit(thingType,
bitType, bitData);
}
Added: poi/trunk/test-data/publisher/60685.pub
URL:
http://svn.apache.org/viewvc/poi/trunk/test-data/publisher/60685.pub?rev=1801405&view=auto
==============================================================================
Binary file - no diff available.
Propchange: poi/trunk/test-data/publisher/60685.pub
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]