mirror of https://github.com/apache/poi.git
Bug 64132: Fix regression introduced by changing factories
We need to return EscherBlipRecord for all types in the defined range of recordId, not UnknownEscherRecord. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885092 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
43e1d6eba6
commit
b7e9cb48d0
|
@ -61,7 +61,7 @@ public class DefaultEscherRecordFactory implements EscherRecordFactory {
|
|||
return EscherContainerRecord::new;
|
||||
}
|
||||
|
||||
if (recordTypes.constructor != null) {
|
||||
if (recordTypes.constructor != null && recordTypes != EscherRecordTypes.UNKNOWN) {
|
||||
return recordTypes.constructor;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class EscherBitmapBlip extends EscherBlipRecord {
|
|||
|
||||
@Override
|
||||
public int getRecordSize() {
|
||||
return 8 + 16 + 1 + getPicturedata().length;
|
||||
return 8 + 16 + 1 + (getPicturedata() == null ? 0 : getPicturedata().length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,12 +50,12 @@ public enum EscherRecordTypes {
|
|||
CLSID(0xf016, null, null, null),
|
||||
CALLOUT_RULE(0xf017, null, null, null),
|
||||
BLIP_START(0xf018, "Blip", "msofbtBlip", null),
|
||||
BLIP_EMF(0xf018 + 2, "BlipEmf", null, EscherMetafileBlip::new),
|
||||
BLIP_WMF(0xf018 + 3, "BlipWmf", null, EscherMetafileBlip::new),
|
||||
BLIP_PICT(0xf018 + 4, "BlipPict", null, EscherMetafileBlip::new),
|
||||
BLIP_JPEG(0xf018 + 5, "BlipJpeg", null, EscherBitmapBlip::new),
|
||||
BLIP_PNG(0xf018 + 6, "BlipPng", null, EscherBitmapBlip::new),
|
||||
BLIP_DIB(0xf018 + 7, "BlipDib", null, EscherBitmapBlip::new),
|
||||
BLIP_EMF(0xf018 + 2 /* 0xf01a */, "BlipEmf", null, EscherMetafileBlip::new),
|
||||
BLIP_WMF(0xf018 + 3 /* 0xf01b */, "BlipWmf", null, EscherMetafileBlip::new),
|
||||
BLIP_PICT(0xf018 + 4 /* 0xf01c */, "BlipPict", null, EscherMetafileBlip::new),
|
||||
BLIP_JPEG(0xf018 + 5 /* 0xf01d */, "BlipJpeg", null, EscherBitmapBlip::new),
|
||||
BLIP_PNG(0xf018 + 6 /* 0xf01e */, "BlipPng", null, EscherBitmapBlip::new),
|
||||
BLIP_DIB(0xf018 + 7 /* 0xf01f */, "BlipDib", null, EscherBitmapBlip::new),
|
||||
BLIP_END(0xf117, "Blip", "msofbtBlip", null),
|
||||
REGROUP_ITEMS(0xf118, null, null, null),
|
||||
SELECTION(0xf119, null, null, null),
|
||||
|
|
|
@ -892,4 +892,14 @@ public class TestBugs{
|
|||
assertNotNull(document);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test64132() throws IOException {
|
||||
try(HWPFDocument doc = HWPFTestDataSamples.openSampleFile("64132.doc")) {
|
||||
assertNotNull(doc);
|
||||
PicturesTable picturesTable = doc.getPicturesTable();
|
||||
List<Picture> pictures = picturesTable.getAllPictures();
|
||||
assertNotNull(pictures);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue