diff options
author | Yegor Kozlov <yegor@apache.org> | 2009-02-20 13:49:33 +0000 |
---|---|---|
committer | Yegor Kozlov <yegor@apache.org> | 2009-02-20 13:49:33 +0000 |
commit | d5e64851f69b76853abfa69d9d69a0904e603991 (patch) | |
tree | 8b58377c8a569d56650b5d39a1eeef6da60f26cd /src/scratchpad | |
parent | b0d231437c30a3fc89d1e9c06265f09166e39698 (diff) | |
download | poi-d5e64851f69b76853abfa69d9d69a0904e603991.tar.gz poi-d5e64851f69b76853abfa69d9d69a0904e603991.zip |
fixed a possible NPE in SimpleShape.getClientRecords()
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@746238 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad')
-rw-r--r-- | src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java | 7 | ||||
-rw-r--r-- | src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java | 9 |
2 files changed, 7 insertions, 9 deletions
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 0d8992f36a..b0bdcadcca 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 <code>null</code> + */ 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 f04fbbd5b2..9c213d4773 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); |