< prev index next >
src/java.base/share/classes/java/util/zip/ZipFile.java
Print this page
rev 49550 : 8201179: Regression due loading java.nio.charset.StandardCharsets during bootstrap
Reviewed-by: sherman
@@ -32,11 +32,10 @@
import java.io.File;
import java.io.RandomAccessFile;
import java.io.UncheckedIOException;
import java.lang.ref.Cleaner.Cleanable;
import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.Files;
import java.util.ArrayDeque;
import java.util.ArrayList;
@@ -64,10 +63,12 @@
import jdk.internal.misc.VM;
import jdk.internal.perf.PerfCounter;
import jdk.internal.ref.CleanerFactory;
import jdk.internal.vm.annotation.Stable;
+import sun.nio.cs.UTF_8;
+
import static java.util.zip.ZipConstants64.*;
import static java.util.zip.ZipUtils.*;
/**
* This class is used to read entries from a zip file.
@@ -171,11 +172,11 @@
* @throws IllegalArgumentException if the {@code mode} argument is invalid
* @see SecurityManager#checkRead(java.lang.String)
* @since 1.3
*/
public ZipFile(File file, int mode) throws IOException {
- this(file, mode, StandardCharsets.UTF_8);
+ this(file, mode, UTF_8.INSTANCE);
}
/**
* Opens a ZIP file for reading given the specified File object.
*
@@ -1092,11 +1093,11 @@
String[] names = new String[zsrc.metanames.length];
byte[] cen = zsrc.cen;
for (int i = 0; i < names.length; i++) {
int pos = zsrc.metanames[i];
names[i] = new String(cen, pos + CENHDR, CENNAM(cen, pos),
- StandardCharsets.UTF_8);
+ UTF_8.INSTANCE);
}
return names;
}
}
< prev index next >