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
This commit is contained in:
Nick Burch 2011-09-23 16:24:56 +00:00
parent e5b4f1b58d
commit 40d19a5fa3
2 changed files with 14 additions and 3 deletions

View File

@ -34,6 +34,7 @@
<changes>
<release version="3.8-beta5" date="2011-??-??">
<action dev="poi-developers" type="fix">51873 - update HSMF to ignore Outlook 2002 Olk10SideProp entries, which don't behave like normal chunks</action>
<action dev="poi-developers" type="fix">51850 - support creating comments in XSSF on an earlier slide when later ones already have them</action>
<action dev="poi-developers" type="add">51804 - optionally include Master Slide text in XSLF text extraction, as HSLF already offers</action>
<action dev="poi-developers" type="add">New PackagePart method getRelatedPart(PackageRelationship) to simplify navigation of relations between OPC Parts</action>

View File

@ -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 __<name>_<id><type>
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);