From 2b10e019ad64defad6fdb7258269b76dd67ffced Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Wed, 19 Oct 2016 05:00:07 +0000 Subject: [PATCH] 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 --- src/java/org/apache/poi/poifs/macros/VBAMacroReader.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); } } -- 2.39.5