https://issues.apache.org/bugzilla/show_bug.cgi?id=49236
Summary: JAR indexing does not have any benefits and can cause some harm Product: Tomcat 7 Version: trunk Platform: PC OS/Version: Windows XP Status: NEW Severity: normal Priority: P2 Component: Packaging AssignedTo: dev@tomcat.apache.org ReportedBy: knst.koli...@gmail.com In TC 7, 6, 5.5 build scripts in several places we use <jar index="true"/>, which creates META-INF/INDEX.LIST file in the JAR. I should say that a) The JAR Index feature is designed to speed up location and download of other *.jar files. It is not intended to be used on a single file. See specification [1], blog article that describes main problems [2], ANT documentation on JAR task and especially the nested "indexjars" element as described there [3]. One should use <indexjars> element inside the <jar> task to exploit this feature properly. b) It does not speed up processing of a single JAR. First, a JAR file already has an index, "Central Directory" - see picture in Wikipedia article [4], or official specification from PKWARE [5]. AFAIK, in Sun JRE this central directory is always read and loaded into memory before any random-access query on the file is performed, such as ZipFile#getEntry(String). Second, an URLClassLoader has to consider JARs mentioned in the Index file. It incurs some overhead, though I have not measured how much it is. c) Using Index file can conflict with "Class-Path" entry of the manifest. See [2] for explanation. Also the text of the index file starts with the name of the current JAR file. I suppose that it can have some consequences if the file is renamed. Based on the above, we have to use index="false" on all our <jar> tasks. Links: [1] JAR Index specification - JDK 1.5 http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#JAR%20Index [2] To Use or not to Use Jar Index - A blog article http://javahowto.blogspot.com/2006/08/to-use-or-not-to-use-jar-index.html [3] Jar Task - Apache ANT Documentation http://ant.apache.org/manual/CoreTasks/jar.html [4] ZIP (file format) - Wikipedia http://en.wikipedia.org/wiki/ZIP_%28file_format%29#Technical_information [5] ZIP APPNOTE - PKWARE http://www.pkware.com/support/zip-application-note -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org