fixed a possible NPE in SimpleShape.getClientRecords()

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@746238 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yegor Kozlov 2009-02-20 13:49:33 +00:00
parent b0d231437c
commit d5e64851f6
2 changed files with 7 additions and 9 deletions

View File

@ -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());

View File

@ -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);