diff options
author | Javen O'Neal <onealj@apache.org> | 2016-07-02 18:28:43 +0000 |
---|---|---|
committer | Javen O'Neal <onealj@apache.org> | 2016-07-02 18:28:43 +0000 |
commit | af5351527946edb6b543f0e30f87d440b9f6b33a (patch) | |
tree | e22751ef10a540e6433ab52d4971d4d0fd2856e2 /src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java | |
parent | 80e3a64280b0e099ba0b0d2d94520cf9ad025362 (diff) | |
download | poi-af5351527946edb6b543f0e30f87d440b9f6b33a.tar.gz poi-af5351527946edb6b543f0e30f87d440b9f6b33a.zip |
bug 59773: move loop invariants outside of loop or change for loops to for-each loops
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1751086 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java')
-rw-r--r-- | src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java index 19176392d1..980f1b7ad6 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java @@ -379,18 +379,17 @@ public class XSSFRichTextString implements RichTextString { * index is out of range. */ public XSSFFont getFontAtIndex( int index ) { - if(st.sizeOfRArray() == 0) return null; - + final ThemesTable themes = getThemesTable(); int pos = 0; - for(int i = 0; i < st.sizeOfRArray(); i++){ - CTRElt r = st.getRArray(i); - if(index >= pos && index < pos + r.getT().length()) { + for(CTRElt r : st.getRArray()){ + final int length = r.getT().length(); + if(index >= pos && index < pos + length) { XSSFFont fnt = new XSSFFont(toCTFont(r.getRPr())); - fnt.setThemesTable(getThemesTable()); + fnt.setThemesTable(themes); return fnt; } - pos += r.getT().length(); + pos += length; } return null; |