]> source.dussan.org Git - poi.git/commitdiff
Fix a 1.6ism
authorNick Burch <nick@apache.org>
Fri, 11 Feb 2011 22:35:20 +0000 (22:35 +0000)
committerNick Burch <nick@apache.org>
Fri, 11 Feb 2011 22:35:20 +0000 (22:35 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1069974 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java

index d8416c9d6fcb35e77e62ac36fb6d4a3bc8a54fd5..1809b7c0404dcac9b6b817c50011fef0a6ee723f 100644 (file)
@@ -494,8 +494,13 @@ public class XSSFRichTextString implements RichTextString {
             }
 
             if(startIndex > 0 && !formats.containsKey(startIndex)) {
-                Map.Entry<Integer, CTRPrElt> he = formats.higherEntry(startIndex); //TODO TreeMap#higherEntry is JDK 1.6 only!
-                if(he != null) formats.put(startIndex, he.getValue());
+                // If there's a format that starts later in the string, make it start now
+                for(Map.Entry<Integer, CTRPrElt> entry : formats.entrySet()) {
+                   if(entry.getKey() > startIndex) {
+                      formats.put(startIndex, entry.getValue());
+                      break;
+                   }
+                }
             }
             formats.put(endIndex, fmt);