(original) (raw)
I have an updated version of this fix, with these changes:
- Documented the turkish i problem
��� /**
���� * Compares two strings for equality, ignoring case.� The second
���� * argument must contain only upper-case ASCII characters.
���� * We don't want case comparison to be locale-dependent (else we
���� * have the notorious "turkish i bug").
���� */
��� private boolean equalsIgnoreCase(String s, String upper) {
- Refactored code so that updateEntry now also sets the method to STORED.
������� /**
�������� * Updates a ZipEntry which describes the data read by this
�������� * output stream, in STORED mode.
�������� */
������� public void updateEntry(ZipEntry e) {
����������� e.setMethod(ZipEntry.STORED);
����������� e.setSize(n);
����������� e.setCrc(crc.getValue());
������� }
- addIndex was never updating the size in the ZipEntry (as required),
� which was not previously noticed because closeEntry was never called.
��� private void addIndex(JarIndex index, ZipOutputStream zos)
������� throws IOException
��� {
������� ZipEntry e = new ZipEntry(INDEX_NAME);
������� e.setTime(System.currentTimeMillis());
������� if (flag0) {
����������� CRC32OutputStream os = new CRC32OutputStream(crc32);
����������� index.write(os);
����������� os.updateEntry(e);
������� }
������� zos.putNextEntry(e);
������� index.write(zos);
������� zos.closeEntry();
��� }
http://cr.openjdk.java.net/~martin/jar-misc/
Previous webrev:
http://cr.openjdk.java.net/~martin/jar-misc.0/
Martin
Hi jar team,
I have a bunch of minor improvements to
�src/share/classes/sun/tools/jar/Main.java
Toby and Xueming, please review.
Warning: the index code has not been maintained for many years.
Xueming, please file a bug.
Synopsis: Miscellaneous improvements to "jar".
Description:
- Use standard jdk coding style for javadoc
- Don't create a temp file for jar index in STORED mode.
- Don't use synchronized collections.
- Fix javac warnings.
- Don't define new names for things like INDEX_NAME;
� use static import instead.
- more efficiently compare special file names in update mode.� Update mode should be measurably faster.
- make CRC32OutputStream a nested class.
� refactor crc32.reset and updating entry into CRC32OutputStream.
- Fix apparently benign bug updating n in CRC32OutputStream.write(byte[], int, int)
Evaluation: Yep.
http://cr.openjdk.java.net/~martin/jar-misc/
Thanks,
Martin