]> source.dussan.org Git - poi.git/commitdiff
avoid nulls in HSSFWorkbook.getAllPictures when EscherBlipRecord is not found
authorYegor Kozlov <yegor@apache.org>
Wed, 20 Oct 2010 16:38:06 +0000 (16:38 +0000)
committerYegor Kozlov <yegor@apache.org>
Wed, 20 Oct 2010 16:38:06 +0000 (16:38 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1025635 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPictureData.java

index 24999fe2033e09f19cebae68591b8ad0579bddbc..7cedfecacdb3853025e81604643f69874b81f2ec 100644 (file)
@@ -1594,8 +1594,6 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
                     // TODO: Some kind of structure.
                     HSSFPictureData picture = new HSSFPictureData(blip);
                                        pictures.add(picture);
-                } else {
-                       pictures.add(null);
                 }
                 
                 
index e351e266904d99a9e5db319fdbcc5f6a0cd00bcc..99f4ad80684df71a8ffe2c8fc60e0c764fdc09e2 100644 (file)
@@ -71,4 +71,16 @@ public final class TestHSSFPictureData extends TestCase{
             }
         }
     }
+
+    public void testNotNullPictures() throws IOException {
+
+        HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("SheetWithDrawing.xls");
+
+        @SuppressWarnings("unchecked") // TODO - add getFormat() to interface PictureData and genericise wb.getAllPictures()
+        List<HSSFPictureData> lst = (List<HSSFPictureData>)(List<?>)wb.getAllPictures();
+        for(HSSFPictureData pict : lst){
+            assertNotNull(pict);
+        }
+    }
+
 }