From: Nick Burch Date: Fri, 23 Sep 2011 16:24:56 +0000 (+0000) Subject: Fix bug #51873 - update HSMF to ignore Outlook 2002 Olk10SideProp entries, which... X-Git-Tag: REL_3_8_BETA5~126 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d2dd89ea6a0f54ebd38c4f8d236e246fa3d59388;p=poi.git Fix bug #51873 - update HSMF to ignore Outlook 2002 Olk10SideProp entries, which don't behave like normal chunks git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1174868 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 72f74129da..e0ba0b061a 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 51873 - update HSMF to ignore Outlook 2002 Olk10SideProp entries, which don't behave like normal chunks 51850 - support creating comments in XSSF on an earlier slide when later ones already have them 51804 - optionally include Master Slide text in XSLF text extraction, as HSLF already offers New PackagePart method getRelatedPart(PackageRelationship) to simplify navigation of relations between OPC Parts diff --git a/src/scratchpad/src/org/apache/poi/hsmf/parsers/POIFSChunkParser.java b/src/scratchpad/src/org/apache/poi/hsmf/parsers/POIFSChunkParser.java index 81c0d8b02a..656078c4c6 100644 --- a/src/scratchpad/src/org/apache/poi/hsmf/parsers/POIFSChunkParser.java +++ b/src/scratchpad/src/org/apache/poi/hsmf/parsers/POIFSChunkParser.java @@ -121,13 +121,23 @@ public final class POIFSChunkParser { // Split it into its parts int splitAt = entryName.lastIndexOf('_'); - if(splitAt == -1 || splitAt > (entryName.length()-8)) { + String namePrefix = entryName.substring(0, splitAt+1); + String ids = entryName.substring(splitAt+1); + + // Make sure we got what we expected, should be of + // the form ___ + if(namePrefix.equals("Olk10SideProps")) { + // This is some odd Outlook 2002 thing, skip + return; + } else if(splitAt <= entryName.length()-8) { + // In the right form for a normal chunk + // We'll process this further in a little bit + } else { + // Underscores not the right place, something's wrong throw new IllegalArgumentException("Invalid chunk name " + entryName); } // Now try to turn it into id + type - String namePrefix = entryName.substring(0, splitAt+1); - String ids = entryName.substring(splitAt+1); try { int chunkId = Integer.parseInt(ids.substring(0, 4), 16); int type = Integer.parseInt(ids.substring(4, 8), 16);