1 Star 0 Fork 80

xuyuchao/openjdk-1.8.0

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
add-8170831-ZipFile-implementation-no-longer-caches-.patch 1.71 KB
一键复制 编辑 原始数据 按行查看 历史
DXwangg 提交于 2023-09-26 09:10 . Add feature and bug fix for 8u382
From 8e3e20eef3f18d023ffc327a9fae30c34de84773 Mon Sep 17 00:00:00 2001
Date: Thu, 21 Sep 2023 15:24:45 +0800
Subject: add 8170831-ZipFile-implementation-no-longer-caches-the
---
jdk/src/share/classes/java/util/zip/ZipFile.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/jdk/src/share/classes/java/util/zip/ZipFile.java b/jdk/src/share/classes/java/util/zip/ZipFile.java
index b6a6c2a48..38b642bdc 100644
--- a/jdk/src/share/classes/java/util/zip/ZipFile.java
+++ b/jdk/src/share/classes/java/util/zip/ZipFile.java
@@ -342,7 +342,9 @@ class ZipFile implements ZipConstants, Closeable {
ZipFileInputStream in = null;
synchronized (this) {
ensureOpen();
- if (!zc.isUTF8() && (entry.flag & EFS) != 0) {
+ if (Objects.equals(lastEntryName, entry.name)) {
+ pos = lastEntryPos;
+ } else if (!zc.isUTF8() && (entry.flag & EFS) != 0) {
pos = zsrc.getEntryPos(zc.getBytesUTF8(entry.name), false);
} else {
pos = zsrc.getEntryPos(zc.getBytes(entry.name), false);
@@ -533,6 +535,9 @@ class ZipFile implements ZipConstants, Closeable {
Spliterator.IMMUTABLE | Spliterator.NONNULL), false);
}
+ private String lastEntryName;
+ private int lastEntryPos;
+
/* Checks ensureOpen() before invoke this method */
private ZipEntry getZipEntry(String name, int pos) {
byte[] cen = zsrc.cen;
@@ -566,6 +571,8 @@ class ZipFile implements ZipConstants, Closeable {
e.comment = zc.toString(cen, start, clen);
}
}
+ lastEntryName = e.name;
+ lastEntryPos = pos;
return e;
}
--
2.22.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xuyuchao/openjdk-1.8.0.git
git@gitee.com:xuyuchao/openjdk-1.8.0.git
xuyuchao
openjdk-1.8.0
openjdk-1.8.0
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891