I have an updated version of this fix, with these changes:<br><br>- Documented the turkish i problem<br><br>    /**<br>     * Compares two strings for equality, ignoring case.  The second<br>     * argument must contain only upper-case ASCII characters.<br>
     * We don't want case comparison to be locale-dependent (else we<br>     * have the notorious "turkish i bug").<br>     */<br>    private boolean equalsIgnoreCase(String s, String upper) {<br><br>- Refactored code so that updateEntry now also sets the method to STORED.<br>
<br>        /**<br>         * Updates a ZipEntry which describes the data read by this<br>         * output stream, in STORED mode.<br>         */<br>        public void updateEntry(ZipEntry e) {<br>            e.setMethod(ZipEntry.STORED);<br>
            e.setSize(n);<br>            e.setCrc(crc.getValue());<br>        }<br><br>- addIndex was never updating the size in the ZipEntry (as required),<br>  which was not previously noticed because closeEntry was never called.<br>
<br>    private void addIndex(JarIndex index, ZipOutputStream zos)<br>        throws IOException<br>    {<br>        ZipEntry e = new ZipEntry(INDEX_NAME);<br>        e.setTime(System.currentTimeMillis());<br>        if (flag0) {<br>
            CRC32OutputStream os = new CRC32OutputStream(crc32);<br>            index.write(os);<br>            os.updateEntry(e);<br>        }<br>        zos.putNextEntry(e);<br>        index.write(zos);<br>        zos.closeEntry();<br>
    }<br><br><a href="http://cr.openjdk.java.net/~martin/jar-misc/">http://cr.openjdk.java.net/~martin/jar-misc/</a><br>Previous webrev:<br><a href="http://cr.openjdk.java.net/~martin/jar-misc.0/">http://cr.openjdk.java.net/~martin/jar-misc.0/</a><br>
<br>Martin<br><br><br><div class="gmail_quote">On Wed, Jun 24, 2009 at 19:34, Martin Buchholz <span dir="ltr"><<a href="mailto:martinrb@google.com">martinrb@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi jar team,<br><br>I have a bunch of minor improvements to <br> src/share/classes/sun/tools/jar/Main.java<br><br>Toby and Xueming, please review.<br><br>Warning: the index code has not been maintained for many years.<br>
<br>
Xueming, please file a bug.<br><br>Synopsis: Miscellaneous improvements to "jar".<br>Description:<br>- Use standard jdk coding style for javadoc<br>- Don't create a temp file for jar index in STORED mode.<br>

- Don't use synchronized collections.<br>- Fix javac warnings.<br>- Don't define new names for things like INDEX_NAME;<br>  use static import instead.<br>- more efficiently compare special file names in update mode.<br>

  Update mode should be measurably faster.<br>- make CRC32OutputStream a nested class.<br>  refactor crc32.reset and updating entry into CRC32OutputStream.<br>- Fix apparently benign bug updating n in CRC32OutputStream.write(byte[], int, int)<br>

<br>Evaluation: Yep.<br><br><a href="http://cr.openjdk.java.net/%7Emartin/jar-misc/" target="_blank">http://cr.openjdk.java.net/~martin/jar-misc/</a><br><br>Thanks,<br><font color="#888888"><br>Martin<br>
</font></blockquote></div><br>