ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 37237] New: - JAR_MARKER added in 1.6.3 breaks indexjar element in jar task
Date Tue, 25 Oct 2005 00:27:33 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37237>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=37237

           Summary: JAR_MARKER added in 1.6.3 breaks indexjar element in jar
                    task
           Product: Ant
           Version: 1.6.3
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: edward.kuns@concerto.com
                CC: edward.kuns@concerto.com


A project I work on uses an indexed jar file.  This builds perfectly under Ant
1.6.2 and earlier, but under 1.6.3 and later it breaks with the error message:

Z:\uwa\Build\build.jars.xml:163: java.lang.RuntimeException: data starting at 0
is in unknown format

That error message comes from ExtraFieldUtils.parse(byte[]).  The line
complained about is the "jar" task.  To simplify, part of this ant target is:

      <delete file="${agent.lib}/agent.jar" failonerror="false"/>
      <delete file="${agent.lib}/agent.jar"/>
      <jar jarfile="${agent.lib}/agent.jar" manifest="META-INF/manifest.mf"
index="true">
        <fileset dir="${classes}/">
          <include name="${stemDir}/agent/**/*.class"/>
          <include name="${stemDir}/agent/i18n/*.properties"/>
        </fileset>
        <!-- Dependencies outside the agent source tree -->
        <fileset dir="${srcdir}">
          <include name="META-INF/services/org.apache.commons.logging.LogFactory"/>
        </fileset>
        <indexjars>
          <fileset file="${agent.lib}/client.jar"/>
          <fileset dir="${libdir}/">
            <include name="commons-codec.jar"/>
            <include name="commons-httpclient.jar"/>
            <include name="commons-logging.jar"/>
            <include name="jakarta-oro.jar"/>
            <include name="log4j.jar"/>
          </fileset>
        </indexjars>
      </jar>

Looking at the source for 1.6.5 (since it is the most recent release) I find if
I comment out two lines added to org.apache.tools.ant.taskdefs.Jar in 1.6.3,
then I do not have this breakage.  I comment out the lines:

        zipDir(null, zOut, "META-INF/", ZipFileSet.DEFAULT_DIR_MODE,
               JAR_MARKER);

Obviously, this is not the correct fix, but I am hoping that someone who is
familiar with this code will immediately see what is causing this problem with
jar indexing.  The JAR_MARKER's ID is 0xCAFE.  If in
ExtraFieldUtils.parse(byte[]) I dump the byte array coming in, the byte array is
 zero length for absolutely every invocation except one -- the META_INF
directory.  For this directory, the data array contains the values 0, 4, -2, -54
(or 4, 0, -2, -54 ... I don't remember the order of the first two, just the
values).  If I translate the last two into hex, I see 0xFE, 0xCA, aka 0xCAFE,
the ID from the JarMarker class.

If I remove the indexjars element from the jar task, but leave the index="true"
attribute, I do not get this error.  This error occurs only when the indexjars
element is present for ANT 1.6.3 and later.  I have not tested the current SVN
version.  I've searched the bug database for anything like this and have not
found anything.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message