From: Eric L. <Eri...@mi...> - 2003-08-15 20:51:34
|
Hi Jazzlib developers, Thanks for providing this open source project to the Java community. I have found a couple bugs in jazzlib regarding to the DBCS (Double-byte character set, eg. Chinese) paths and file names. 1) In file ZipFile.java, inside method checkLocalHeader if (entry.getName().length() != readLeShort(locBuf, LOCNAM)) throw new ZipException("file name length mismatch: " + name); The if statement is wrong, and it should be if (entry.getName().getBytes(),length != readLeShort(locBuf, LOCNAM)) throw new ZipException("file name length mismatch: " + name); We should use the number of bytes rather than the number of characters as they are not the same for DBCS. 2. In file ZipFile, inside method readEntries String name = new String(buffer, 0, 0, nameLen); We shouldn't use this constructor because it is deprecated and it is not correct for DBCS. This should be changed to... String name = new String(buffer, 0, nameLen); If these are the right ways to go, I hope these bugs could be fixed in the next version. Please let me know if you need more information from me. Thanks. Regards, Eric Lee Micro Focus (Sunnyvale) Email: Eri...@mi... <mailto:Eri...@mi...> Phone number: (408) 222-0358 |