poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r746238 - in /poi/trunk/src/scratchpad: src/org/apache/poi/hslf/model/SimpleShape.java testcases/org/apache/poi/hslf/extractor/TestExtractor.java
Date Fri, 20 Feb 2009 13:49:33 GMT
Author: yegor
Date: Fri Feb 20 13:49:33 2009
New Revision: 746238

URL: http://svn.apache.org/viewvc?rev=746238&view=rev
Log:
fixed a possible NPE in SimpleShape.getClientRecords()

Modified:
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java?rev=746238&r1=746237&r2=746238&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java Fri Feb 20 13:49:33
2009
@@ -314,12 +314,17 @@
         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());

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java?rev=746238&r1=746237&r2=746238&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java Fri
Feb 20 13:49:33 2009
@@ -237,14 +237,7 @@
 		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);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message