]> source.dussan.org Git - poi.git/commitdiff
52863 - add workaround for files with broken CHP SPRMs
authorSergey Vladimirov <sergey@apache.org>
Mon, 5 Nov 2012 16:06:36 +0000 (16:06 +0000)
committerSergey Vladimirov <sergey@apache.org>
Mon, 5 Nov 2012 16:06:36 +0000 (16:06 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1405861 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/status.xml
src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java

index 4a76471aee290b7bb6417992a9a6390a2e41948f..ad3b0f62b96ac0ae3d4f53c84790a05d7953df13 100644 (file)
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.9-beta1" date="2012-??-??">
+          <action dev="poi-developers" type="add">52863 - add workaround for files with broken CHP SPRMs</action>
           <action dev="poi-developers" type="fix">53182 - Reading combined character styling and direct formatting of a character run</action>
           <action dev="poi-developers" type="fix">52311 - Conversion to html : Problem in titles number </action>
           <action dev="poi-developers" type="fix">53914 - TableRow#getTopBorder() return bottom's border</action>
index c1b718709f95f8fc1990b97ae29fae06d579b168..6bb3785f4c0bbaff9f290cac032b480804d1f0e7 100644 (file)
@@ -71,14 +71,30 @@ public final class CharacterSprmUncompressor extends SprmUncompressor
         Integer style = getIstd( grpprl, offset );
         if ( style != null )
         {
-            applySprms( parStyle, styleSheet.getCHPX( style ), 0, false,
-                    newProperties );
+            try
+            {
+                applySprms( parStyle, styleSheet.getCHPX( style ), 0, false,
+                        newProperties );
+            }
+            catch ( Exception exc )
+            {
+                logger.log( POILogger.ERROR, "Unable to apply all style ",
+                        style, " CHP SPRMs to CHP: ", exc, exc );
+            }
         }
 
         CharacterProperties styleProperties = newProperties;
         newProperties = styleProperties.clone();
 
-        applySprms( styleProperties, grpprl, offset, true, newProperties );
+        try
+        {
+            applySprms( styleProperties, grpprl, offset, true, newProperties );
+        }
+        catch ( Exception exc )
+        {
+            logger.log( POILogger.ERROR,
+                    "Unable to process all direct CHP SPRMs: ", exc, exc );
+        }
         return newProperties;
     }
 
@@ -109,6 +125,7 @@ public final class CharacterSprmUncompressor extends SprmUncompressor
     private static Integer getIstd( byte[] grpprl, int offset )
     {
         Integer style = null;
+        try
         {
             SprmIterator sprmIt = new SprmIterator( grpprl, offset );
             while ( sprmIt.hasNext() )
@@ -122,6 +139,11 @@ public final class CharacterSprmUncompressor extends SprmUncompressor
                 }
             }
         }
+        catch ( Exception exc )
+        {
+            logger.log( POILogger.ERROR,
+                    "Unable to extract istd from direct CHP SPRM: ", exc, exc );
+        }
         return style;
     }