diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java b/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java index 0d8992f36..b0bdcadcc 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java @@ -314,12 +314,17 @@ public class SimpleShape extends Shape { return null; } + /** + * Search for EscherClientDataRecord, if found, convert its contents into an array of HSLF records + * + * @return an array of HSLF records contained in the shape's EscherClientDataRecord or null + */ protected Record[] getClientRecords() { if(_clientData == null){ EscherRecord r = Shape.getEscherChild(getSpContainer(), EscherClientDataRecord.RECORD_ID); //ddf can return EscherContainerRecord with recordId=EscherClientDataRecord.RECORD_ID //convert in to EscherClientDataRecord on the fly - if(!(r instanceof EscherClientDataRecord)){ + if(r != null && !(r instanceof EscherClientDataRecord)){ byte[] data = r.serialize(); r = new EscherClientDataRecord(); r.fillFields(data, 0, new DefaultEscherRecordFactory()); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java b/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java index f04fbbd5b..9c213d477 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java @@ -237,14 +237,7 @@ public final class TestExtractor extends TestCase { filename = dirname + "/45543.ppt"; ppe = new PowerPointExtractor(filename); - try { - text = ppe.getText(); - } catch (NullPointerException e) { - // TODO - fix this failing test - // This test was failing here with NPE as at svn r745972. - // At that time, the class name was 'TextExtractor' which caused the build script to skip it - return; // for the moment skip the rest of this test. - } + text = ppe.getText(); assertFalse("Comments not in by default", contains(text, "testdoc")); ppe.setCommentsByDefault(true);