Fix some Forbidden APIs errors

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1700646 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2015-09-01 19:16:21 +00:00
parent 71a62c0f9d
commit 3e9159c523
3 changed files with 9 additions and 11 deletions

View File

@ -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;

View File

@ -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 {

View File

@ -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() {