JDK-4415733 : util.zip does not support umlaut (mutated vowel) in file/path-names in zip file
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.jar
  • Affected Version: 1.3.0,1.4.0,1.4.2,5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS:
    windows_98,windows_nt,windows_2000,windows_2003,windows_xp windows_98,windows_nt,windows_2000,windows_2003,windows_xp
  • CPU: x86
  • Submitted: 2001-02-15
  • Updated: 2006-03-27
  • Resolved: 2006-03-27
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Description
Name: boT120536			Date: 02/15/2001


java version "1.3.0_01"
java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_01)
Java HotSpot(TM) Client VM (build 1.3.0_01, mixed mode)

If file or path-names in a zip-file contain a (german) umlaut (mutated vowel,
i.e. "???) or a "?", getNextEntry (when targeting to such a file or path)
throws an IllegalArgumentException.

The error appears in: JDK 1.2.2, JDK 1.3, but *not* in JDK 1.1.8 (which doesn't
help much, for others zip-related errors in 1.1.8).

1. Exact steps to reproduce the problem:

Create a zip-file called "test.zip" containing a file called "test?.tst" (or
something like that) (use winzip or rar). Place the zip in the current
directory.

2. Java SOURCE CODE that demonstrates the problem:

import java.io.*;
import java.util.zip.*;
public class ZIPTest {
  public static void main(String[] args) throws IOException {
    ZipInputStream zis = new ZipInputStream(new FileInputStream
(System.getProperty("user.dir")+File.separatorChar+"test.zip"));
    ZipEntry ze;
    while ((ze = zis.getNextEntry()) != null) {}
    zis.close();
  }
}

3. Exact text of any error message(s) that appeared:

java.lang.IllegalArgumentException
	at java.util.zip.ZipInputStream.getUTF8String(ZipInputStream.java:285)
	at java.util.zip.ZipInputStream.readLOC(ZipInputStream.java:230)
	at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:75)
	at ZIPTest.main(ZIPTest.java:7)
Exception in thread "main"
(Review ID: 116860) 
======================================================================

Comments
EVALUATION By popular request we are closing this bug as a duplicate of 4244499. Votes are being transferred from this bug to that one.
27-03-2006

WORK AROUND Name: boT120536 Date: 02/15/2001 1. Don't use a umlaut in file/path-names in a zip-file. 2. Use JDK 1.1.8 ====================================================================== If you use the `jar' command to create and extract zip or jar files, then filenames with Latin-1 character are correctly handled.
22-09-2004

PUBLIC COMMENTS Different zip implementations use incompatible encodings for non-ASCII names
22-09-2004

EVALUATION Java uses UTF-8 to store file names in JAR files. Other archivers use different encodings. Unfortunately, there is no portable way to determine or specify the encodings of filenames or other data in jar or zip files, and so there is limited interoperability between different zip implementations when non-ASCII file names are used (this is not just a Java issue). The Java zip implementation could - extend the Zip standard so that other implementations could recognize that a zip file was created by Java. - use heuristics to recognize jar/zip files created by other implementations. But that requires a lot of work and inter-implementation compatibility testing that might be broken by an upgrade of a competing implementation. Is the ongoing maintenance effort worth it? ###@###.### 2003-11-06 I believe this is a duplicate of 4244499. See the evaluation of that bug report for a relatively simple proposed solution. ###@###.### 2005-1-29 00:26:29 GMT
06-11-2003