< prev index next >

src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java

Print this page

        

*** 1716,1727 **** ArrayList<Entry> elist = new ArrayList<>(inodes.size()); long written = 0; byte[] buf = null; Entry e; // write loc ! for (IndexNode inode : inodes.values()) { if (inode instanceof Entry) { // an updated inode e = (Entry)inode; try { if (e.type == Entry.COPY) { // entry copy: the only thing changed is the "name" --- 1716,1752 ---- ArrayList<Entry> elist = new ArrayList<>(inodes.size()); long written = 0; 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 ! 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 { if (e.type == Entry.COPY) { // entry copy: the only thing changed is the "name"
< prev index next >