warn and skip wrong type SPRM

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1142764 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-07-04 19:06:20 +00:00
parent 9a17cfcb7f
commit f04b096e28
1 changed files with 12 additions and 1 deletions

View File

@ -17,14 +17,19 @@
package org.apache.poi.hwpf.sprm; 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.CharacterProperties;
import org.apache.poi.hwpf.usermodel.DateAndTime; 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.hwpf.usermodel.ShadingDescriptor;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
public final class CharacterSprmUncompressor public final class CharacterSprmUncompressor
{ {
private static final POILogger logger = POILogFactory
.getLogger( CharacterSprmUncompressor.class );
public CharacterSprmUncompressor() public CharacterSprmUncompressor()
{ {
} }
@ -47,6 +52,12 @@ public final class CharacterSprmUncompressor
while (sprmIt.hasNext()) while (sprmIt.hasNext())
{ {
SprmOperation sprm = sprmIt.next(); SprmOperation sprm = sprmIt.next();
if (sprm.getType() != 2) {
logger.log( POILogger.WARN, "Non-CHP SPRM returned by SprmIterator" );
continue;
}
unCompressCHPOperation(parent, newProperties, sprm); unCompressCHPOperation(parent, newProperties, sprm);
} }