From: Sergey Vladimirov Date: Mon, 4 Jul 2011 19:06:20 +0000 (+0000) Subject: warn and skip wrong type SPRM X-Git-Tag: REL_3_8_BETA4~340 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f04b096e287dcd72e32de6f23b8788f67dbf950a;p=poi.git warn and skip wrong type SPRM git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1142764 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java b/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java index a0c20857b1..bdeedb1620 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java @@ -17,14 +17,19 @@ package org.apache.poi.hwpf.sprm; +import org.apache.poi.hwpf.usermodel.BorderCode; import org.apache.poi.hwpf.usermodel.CharacterProperties; import org.apache.poi.hwpf.usermodel.DateAndTime; -import org.apache.poi.hwpf.usermodel.BorderCode; import org.apache.poi.hwpf.usermodel.ShadingDescriptor; import org.apache.poi.util.LittleEndian; +import org.apache.poi.util.POILogFactory; +import org.apache.poi.util.POILogger; public final class CharacterSprmUncompressor { + private static final POILogger logger = POILogFactory + .getLogger( CharacterSprmUncompressor.class ); + public CharacterSprmUncompressor() { } @@ -47,6 +52,12 @@ public final class CharacterSprmUncompressor while (sprmIt.hasNext()) { SprmOperation sprm = sprmIt.next(); + + if (sprm.getType() != 2) { + logger.log( POILogger.WARN, "Non-CHP SPRM returned by SprmIterator" ); + continue; + } + unCompressCHPOperation(parent, newProperties, sprm); }