From: Nick Burch Date: Fri, 11 Feb 2011 22:35:20 +0000 (+0000) Subject: Fix a 1.6ism X-Git-Tag: REL_3_8_BETA1~19 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=95269a6ad4642d7fd233c84270c537f9d3cbce9f;p=poi.git Fix a 1.6ism git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1069974 13f79535-47bb-0310-9956-ffa450edef68 --- 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 d8416c9d6f..1809b7c040 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java @@ -494,8 +494,13 @@ public class XSSFRichTextString implements RichTextString { } if(startIndex > 0 && !formats.containsKey(startIndex)) { - Map.Entry 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 entry : formats.entrySet()) { + if(entry.getKey() > startIndex) { + formats.put(startIndex, entry.getValue()); + break; + } + } } formats.put(endIndex, fmt);