]> source.dussan.org Git - poi.git/commitdiff
warn and skip wrong type SPRM
authorSergey Vladimirov <sergey@apache.org>
Mon, 4 Jul 2011 19:06:20 +0000 (19:06 +0000)
committerSergey Vladimirov <sergey@apache.org>
Mon, 4 Jul 2011 19:06:20 +0000 (19:06 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1142764 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java

index a0c20857b1b400febc005cfccf56f79a49d786fb..bdeedb162042db5b1a358268e6b6cf1a1bef2498 100644 (file)
 
 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);
     }