diff options
author | Nick Burch <nick@apache.org> | 2015-09-01 19:16:21 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2015-09-01 19:16:21 +0000 |
commit | 2f4f7983b835b28ef930bbdb233c139d7fe8ff02 (patch) | |
tree | 758679de9a0d38d30390dedf6a94c58c692c39db | |
parent | 5c4777ba49425e15013ceac7b71177274591e6d5 (diff) | |
download | poi-2f4f7983b835b28ef930bbdb233c139d7fe8ff02.tar.gz poi-2f4f7983b835b28ef930bbdb233c139d7fe8ff02.zip |
Fix some Forbidden APIs errors
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1700646 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/java/org/apache/poi/hssf/record/DConRefRecord.java | 7 | ||||
-rw-r--r-- | src/java/org/apache/poi/ss/format/CellElapsedFormatter.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/poi/util/StringUtil.java | 11 |
3 files changed, 9 insertions, 11 deletions
diff --git a/src/java/org/apache/poi/hssf/record/DConRefRecord.java b/src/java/org/apache/poi/hssf/record/DConRefRecord.java index deccff347b..bb9b52f1dc 100644 --- a/src/java/org/apache/poi/hssf/record/DConRefRecord.java +++ b/src/java/org/apache/poi/hssf/record/DConRefRecord.java @@ -18,10 +18,11 @@ */ package org.apache.poi.hssf.record; +import java.util.Arrays; + import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndianOutput; - -import java.util.Arrays; +import org.apache.poi.util.StringUtil; /** * DConRef records specify a range in a workbook (internal or external) that serves as a data source @@ -292,7 +293,7 @@ public class DConRefRecord extends StandardRecord { offset++; } - String out = new String(Arrays.copyOfRange(path, offset, path.length)); + String out = new String(Arrays.copyOfRange(path, offset, path.length), StringUtil.UTF8); //UNC paths have \u0003 chars as path separators. out = out.replaceAll("\u0003", "/"); return out; diff --git a/src/java/org/apache/poi/ss/format/CellElapsedFormatter.java b/src/java/org/apache/poi/ss/format/CellElapsedFormatter.java index 72a9a1fd1e..9a90e8a9e5 100644 --- a/src/java/org/apache/poi/ss/format/CellElapsedFormatter.java +++ b/src/java/org/apache/poi/ss/format/CellElapsedFormatter.java @@ -201,7 +201,7 @@ public class CellElapsedFormatter extends CellFormatter { parts[i] = specs.get(i).valueFor(elapsed); } - Formatter formatter = new Formatter(toAppendTo); + Formatter formatter = new Formatter(toAppendTo, Locale.ROOT); try { formatter.format(printfFmt, parts); } finally { diff --git a/src/java/org/apache/poi/util/StringUtil.java b/src/java/org/apache/poi/util/StringUtil.java index bd417961ea..ccf226f0fb 100644 --- a/src/java/org/apache/poi/util/StringUtil.java +++ b/src/java/org/apache/poi/util/StringUtil.java @@ -31,15 +31,12 @@ import org.apache.poi.hssf.record.RecordInputStream; * * Note - none of the methods in this class deals with {@link org.apache.poi.hssf.record.ContinueRecord}s. * For such functionality, consider using {@link RecordInputStream} - * - * - *@author Andrew C. Oliver - *@author Sergei Kozello (sergeikozello at mail.ru) - *@author Toshiaki Kamoshida (kamoshida.toshiaki at future dot co dot jp) */ public class StringUtil { - private static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1"); - private static final Charset UTF16LE = Charset.forName("UTF-16LE"); + protected static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1"); + protected static final Charset UTF16LE = Charset.forName("UTF-16LE"); + public static final Charset UTF8 = Charset.forName("UTF-8"); + private static Map<Integer,Integer> msCodepointToUnicode; private StringUtil() { |