Bug fix. ZipFile.getEntry() should return a copy that doesn't reference the underlying extra byte array (note that the ZipEntry "copy" constructor does not make a copy of the extra byte array).

This commit is contained in:
jfrijters 2011-07-05 06:25:57 +00:00
Родитель 7702563a63
Коммит 75b7458a87
2 изменённых файлов: 2 добавлений и 7 удалений

Просмотреть файл

@ -92,12 +92,7 @@ public class ZipEntry implements ZipConstants, Cloneable
*/ */
public ZipEntry(ZipEntry e) public ZipEntry(ZipEntry e)
{ {
this(e, e.name); name = e.name;
}
ZipEntry(ZipEntry e, String name)
{
this.name = name;
time = e.time; time = e.time;
crc = e.crc; crc = e.crc;
size = e.size; size = e.size;

Просмотреть файл

@ -318,7 +318,7 @@ public class ZipFile implements ZipConstants
// If we didn't find it, maybe it's a directory. // If we didn't find it, maybe it's a directory.
if (entry == null && !name.endsWith("/")) if (entry == null && !name.endsWith("/"))
entry = entries.get(name + '/'); entry = entries.get(name + '/');
return entry != null ? new ZipEntry(entry, name) : null; return entry != null ? (ZipEntry)entry.clone() : null;
} }
/** /**