You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2003/02/11 20:26:44 UTC

DO NOT REPLY [Bug 16972] New: - Jar task incorrectly builds INDEX.LIST entries.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16972>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16972

Jar task incorrectly builds INDEX.LIST entries.

           Summary: Jar task incorrectly builds INDEX.LIST entries.
           Product: Ant
           Version: 1.5.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: jhealy@obs.com


The "META-INF/INDEX.LIST" file created by the core Jar task does not correctly
index files with null package space names.

As defined by the Jar spec (which you quote from on the Jar task's manual page),
the INDEX.LIST file should simply list package directories instead of putting in
a line for every class file (this reduces overhead).  However, to quote:

"Only for classes with null package name, and resource files which reside in the
root directory, will the mapping be recorded at the individual file level."

The Jar task currently does not provide for this exception; when building the
INDEX.LIST file, the Jar task simply iterates over the "addedDirs" Hashtable
from the Zip superclass and prints the directory names out to the index file.

Thus, suppose the following directory structure:

com/obs/test/TestClass.class
resources/foo.xml
resources/bar.gif
root.xml
baz.gif

The correct INDEX.LIST file (as generated by `jar -i` would contain the entries:

com
com/obs
com/obs/test
resources
root.xml
baz.gif

Whereas the Ant-generated Jar would contain only
com
com/obs
com/obs/test
resources

(The root-level elements 'root.xml' and 'baz.gif' would be missing).

As a temporary work-around, the following are possible:

- Do not build indices for Jar files in Ant (set index="no")
- Build indices manually with direct calls to Java's 'jar' tool (jar -i)
- Place all resources in non-root level of Jar heirarchy

I'm not submitting a patch, as I'm not sure how you wish to address the problem.
 Most likely, you'll need to create another hashtable of root elements, and add
to it when you process a file with no directory prefix (line 789 of Zip.java in
v1.5.1 looks like a cozy spot for that).