Author: nick
Date: Tue May 9 03:47:22 2006
New Revision: 405381
URL: http://svn.apache.org/viewcvs?rev=405381&view=rev
Log:
Don't blindly cast children to FontEntityAtom
Modified:
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java
Modified:
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java
URL:
http://svn.apache.org/viewcvs/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java?rev=405381&r1=405380&r2=405381&view=diff
==============================================================================
---
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java
(original)
+++
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java
Tue May 9 03:47:22 2006
@@ -38,13 +38,17 @@
System.arraycopy(source,start,_header,0,8);
_children = Record.findChildRecords(source,start+8,len-8);
- // Save font names into <code>List</code>
- fonts = new ArrayList();
- for (int i = 0; i < _children.length; i++){
- FontEntityAtom atom = (FontEntityAtom)_children[i];
- fonts.add(atom.getFontName());
- }
+ // Save font names into <code>List</code>
+ fonts = new ArrayList();
+ for (int i = 0; i < _children.length; i++){
+ if(_children[i] instanceof FontEntityAtom) {
+ FontEntityAtom atom = (FontEntityAtom)_children[i];
+ fonts.add(atom.getFontName());
+ } else {
+ System.err.println("Warning: FontCollection
child wasn't a FontEntityAtom, was " + _children[i]);
+ }
+ }
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/