]> source.dussan.org Git - poi.git/commitdiff
remove java.nio.charset.StandardCharsets which is not available until Java 7
authorJaven O'Neal <onealj@apache.org>
Wed, 19 Oct 2016 05:00:07 +0000 (05:00 +0000)
committerJaven O'Neal <onealj@apache.org>
Wed, 19 Oct 2016 05:00:07 +0000 (05:00 +0000)
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

index 42902d13118e4a0421b45631ed12539700a6adf5..9003c7a1acccd256aca887b49818d716338641d7 100644 (file)
@@ -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);
     }
 }