From: Javen O'Neal Date: Wed, 19 Oct 2016 05:00:07 +0000 (+0000) Subject: remove java.nio.charset.StandardCharsets which is not available until Java 7 X-Git-Tag: REL_3_16_BETA1~89 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2b10e019ad64defad6fdb7258269b76dd67ffced;p=poi.git remove java.nio.charset.StandardCharsets which is not available until Java 7 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1765528 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/poifs/macros/VBAMacroReader.java b/src/java/org/apache/poi/poifs/macros/VBAMacroReader.java index 42902d1311..9003c7a1ac 100644 --- a/src/java/org/apache/poi/poifs/macros/VBAMacroReader.java +++ b/src/java/org/apache/poi/poifs/macros/VBAMacroReader.java @@ -29,7 +29,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.PushbackInputStream; import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; import java.util.zip.ZipEntry; @@ -55,6 +54,8 @@ import org.apache.poi.util.RLEDecompressingInputStream; public class VBAMacroReader implements Closeable { protected static final String VBA_PROJECT_OOXML = "vbaProject.bin"; protected static final String VBA_PROJECT_POIFS = "VBA"; + // FIXME: When minimum supported version is Java 7, replace with java.nio.charset.StandardCharsets.UTF_16LE + private static final UTF_16LE = Charset.forName("UTF-16LE"); private NPOIFSFileSystem fs; @@ -350,6 +351,6 @@ public class VBAMacroReader implements Closeable { private String readUnicodeString(RLEDecompressingInputStream in, int unicodeNameRecordLength) throws IOException { byte[] buffer = new byte[unicodeNameRecordLength]; IOUtils.readFully(in, buffer); - return new String(buffer, Charset.forName("UTF-16LE")); + return new String(buffer, UTF_16LE); } }