From 40d19a5fa35fa0a1e73156fa22da2aca8c7a42c5 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Fri, 23 Sep 2011 16:24:56 +0000 Subject: [PATCH] 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 --- src/documentation/content/xdocs/status.xml | 1 + .../poi/hsmf/parsers/POIFSChunkParser.java | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 72f74129d..e0ba0b061 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 81c0d8b02..656078c4c 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);