poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From max...@apache.org
Subject svn commit: r931111 - /poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java
Date Tue, 06 Apr 2010 12:12:04 GMT
Author: maxcom
Date: Tue Apr  6 12:12:03 2010
New Revision: 931111

URL: http://svn.apache.org/viewvc?rev=931111&view=rev
Log:
bugfix: ClassCastException it PicturesTable.getAllPictures():
UnknownEscherRecord cannot be cast to EscherBlipRecord

Modified:
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java?rev=931111&r1=931110&r2=931111&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java Tue Apr  6 12:12:03
2010
@@ -168,9 +168,13 @@ public final class PicturesTable
                     {
                         // Blip stored in delay stream, which in a word doc, is the main
stream
                         EscherRecordFactory recordFactory = new DefaultEscherRecordFactory();
-                        blip = (EscherBlipRecord) recordFactory.createRecord(_mainStream,
bse.getOffset());
-                        blip.fillFields(_mainStream, bse.getOffset(), recordFactory);
-                        pictures.add(new Picture(blip.getPicturedata()));
+                        EscherRecord record = recordFactory.createRecord(_mainStream, bse.getOffset());
+
+                        if (record instanceof EscherBlipRecord) {
+                            record.fillFields(_mainStream, bse.getOffset(), recordFactory);
+                            blip = (EscherBlipRecord) record;
+                            pictures.add(new Picture(blip.getPicturedata()));
+                        }
                     }
                 }
 



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


Mime
View raw message