--- old/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java 2018-11-29 12:28:59.298855600 +0530 +++ new/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java 2018-11-29 12:28:58.378064300 +0530 @@ -1066,9 +1066,14 @@ zerror("invalid CEN header (unsupported compression method: " + method + ")"); if (pos + CENHDR + nlen > limit) zerror("invalid CEN header (bad header size)"); - byte[] name = Arrays.copyOfRange(cen, pos + CENHDR, pos + CENHDR + nlen); - IndexNode inode = new IndexNode(name, pos); - inodes.put(inode, inode); + int startIndex = pos + CENHDR; + int endIndex = startIndex + nlen; + startIndex = ((nlen > 0) && (char)cen[startIndex] == '/') ? startIndex + 1 : startIndex; + byte[] name = Arrays.copyOfRange(cen, startIndex, endIndex); + if(name.length > 0){ + IndexNode inode = new IndexNode(name, pos); + inodes.put(inode, inode); + } // skip ext and comment pos += (CENHDR + nlen + elen + clen); }