Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8211917: Zip FS should add META-INF/MANIFEST.FS at the start of the Z…
…ip/JAR

Reviewed-by: clanger, jpai
  • Loading branch information
Lance Andersen committed Mar 5, 2020
1 parent db91be2 commit 3607ddd55abd5c6b05d4ff9004fa2ef328a32c4c
@@ -1718,8 +1718,33 @@ private void sync() throws IOException {
byte[] buf = null;
Entry e;

final IndexNode manifestInode = inodes.get(
IndexNode.keyOf(getBytes("/META-INF/MANIFEST.MF")));
final Iterator<IndexNode> inodeIterator = inodes.values().iterator();
boolean manifestProcessed = false;

// write loc
for (IndexNode inode : inodes.values()) {
while (inodeIterator.hasNext()) {
final IndexNode inode;

// write the manifest inode (if any) first so that
// java.util.jar.JarInputStream can find it
if (manifestInode == null) {
inode = inodeIterator.next();
} else {
if (manifestProcessed) {
// advance to next node, filtering out the manifest
// which was already written
inode = inodeIterator.next();
if (inode == manifestInode) {
continue;
}
} else {
inode = manifestInode;
manifestProcessed = true;
}
}

if (inode instanceof Entry) { // an updated inode
e = (Entry)inode;
try {
@@ -0,0 +1,4 @@
# Zip FS unit tests uses TestNG
modules = jdk.zipfs
TestNG.dirs = .

0 comments on commit 3607ddd

Please sign in to comment.