|
|
@@ -278,19 +278,12 @@ public final class JarUtil {
|
|
|
ZipEntry zipEntry = entries.nextElement();
|
|
|
zipEntryList.add(zipEntry);
|
|
|
}
|
|
|
-
|
|
|
- Map<String, byte[]> originBytesMap = new HashMap<>(64);
|
|
|
- for (ZipEntry zipEntry : zipEntryList) {
|
|
|
- String zipEntryName = zipEntry.getName();
|
|
|
- byte[] originBytes = IOUtil.toBytes(zipFile.getInputStream(zipEntry));
|
|
|
- originBytesMap.put(zipEntryName, originBytes);
|
|
|
- }
|
|
|
// zipFile.getName()形如: /abc/my-project.jar /abc/my-project.war /abc/my-projectzip
|
|
|
- try (FileOutputStream fos = new FileOutputStream(zipFilePath, false);
|
|
|
+ try (FileOutputStream fos = new FileOutputStream(zipFilePath, true);
|
|
|
ZipOutputStream zos = new ZipOutputStream(fos)) {
|
|
|
for (ZipEntry zipEntry : zipEntryList) {
|
|
|
String zipEntryName = zipEntry.getName();
|
|
|
- byte[] originBytes = originBytesMap.get(zipEntryName);
|
|
|
+ byte[] originBytes = IOUtil.toBytes(zipFile.getInputStream(zipEntry));
|
|
|
byte[] replaceBytes = replacerMap.get(zipEntryName);
|
|
|
if (replacerMap.containsKey(zipEntryName) && replaceBytes != null) {
|
|
|
// 覆盖
|