diff options
author | Josh Micich <josh@apache.org> | 2008-11-29 02:07:49 +0000 |
---|---|---|
committer | Josh Micich <josh@apache.org> | 2008-11-29 02:07:49 +0000 |
commit | 545ebccb609f0922d36ea3778fd33e39a3677f71 (patch) | |
tree | dc7adcadc5c0074cd358097f0ff573c82000d5dc | |
parent | c1e9124f2b62cfb62a24d81abef1e846776d661d (diff) | |
download | poi-545ebccb609f0922d36ea3778fd33e39a3677f71.tar.gz poi-545ebccb609f0922d36ea3778fd33e39a3677f71.zip |
Simplified logic in getStyleRecord() (investigating bug 46259)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@721614 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/java/org/apache/poi/hssf/model/Workbook.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/java/org/apache/poi/hssf/model/Workbook.java b/src/java/org/apache/poi/hssf/model/Workbook.java index 76854518f8..765dc1afd3 100644 --- a/src/java/org/apache/poi/hssf/model/Workbook.java +++ b/src/java/org/apache/poi/hssf/model/Workbook.java @@ -72,6 +72,7 @@ import org.apache.poi.hssf.record.StyleRecord; import org.apache.poi.hssf.record.SupBookRecord; import org.apache.poi.hssf.record.TabIdRecord; import org.apache.poi.hssf.record.UnicodeString; +import org.apache.poi.hssf.record.UnknownRecord; import org.apache.poi.hssf.record.UseSelFSRecord; import org.apache.poi.hssf.record.WindowOneRecord; import org.apache.poi.hssf.record.WindowProtectRecord; @@ -824,18 +825,17 @@ public final class Workbook implements Model { public StyleRecord getStyleRecord(int xfIndex) { // Style records always follow after // the ExtendedFormat records - boolean done = false; - for(int i=records.getXfpos(); i<records.size() && - !done; i++) { + for(int i=records.getXfpos(); i<records.size(); i++) { Record r = records.get(i); if(r instanceof ExtendedFormatRecord) { - } else if(r instanceof StyleRecord) { - StyleRecord sr = (StyleRecord)r; - if(sr.getXFIndex() == xfIndex) { - return sr; - } - } else { - done = true; + continue; + } + if(!(r instanceof StyleRecord)) { + return null; + } + StyleRecord sr = (StyleRecord)r; + if(sr.getXFIndex() == xfIndex) { + return sr; } } return null; |