diff options
author | Javen O'Neal <onealj@apache.org> | 2017-07-10 01:34:30 +0000 |
---|---|---|
committer | Javen O'Neal <onealj@apache.org> | 2017-07-10 01:34:30 +0000 |
commit | 34d9764ca55bd3999748dd17e1a52ae54c16736f (patch) | |
tree | 5a8043e8032b7f2d0531a99e8256ef9228c83c1a | |
parent | 61841e51e92a3bbc63479acbb8caaece50e2edc9 (diff) | |
download | poi-34d9764ca55bd3999748dd17e1a52ae54c16736f.tar.gz poi-34d9764ca55bd3999748dd17e1a52ae54c16736f.zip |
bug 60685: ignore problems with HPBF Publisher Quill Contents PLC hyperlink records so that text extraction can continue
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1801405 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/scratchpad/src/org/apache/poi/hpbf/model/QuillContents.java | 12 | ||||
-rw-r--r-- | test-data/publisher/60685.pub | bin | 0 -> 119296 bytes |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/scratchpad/src/org/apache/poi/hpbf/model/QuillContents.java b/src/scratchpad/src/org/apache/poi/hpbf/model/QuillContents.java index f813b9455c..439055c8aa 100644 --- a/src/scratchpad/src/org/apache/poi/hpbf/model/QuillContents.java +++ b/src/scratchpad/src/org/apache/poi/hpbf/model/QuillContents.java @@ -26,11 +26,15 @@ import org.apache.poi.hpbf.model.qcbits.UnknownQCBit; 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 HPBFPart { 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); } diff --git a/test-data/publisher/60685.pub b/test-data/publisher/60685.pub Binary files differnew file mode 100644 index 0000000000..37d3dce70e --- /dev/null +++ b/test-data/publisher/60685.pub |