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 2002/08/21 18:42:28 UTC

DO NOT REPLY [Bug 11903] New: - org.apache.tools.zip.ZipOutputStream.finish(ZipOutputStream.java(Compiled Code)) exception while creating a jar file

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=11903>.
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=11903

org.apache.tools.zip.ZipOutputStream.finish(ZipOutputStream.java(Compiled Code)) exception while creating a jar file

           Summary: org.apache.tools.zip.ZipOutputStream.finish(ZipOutputStr
                    eam.java(Compiled Code)) exception while creating a jar
                    file
           Product: Ant
           Version: 1.5
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Core tasks
        AssignedTo: ant-dev@jakarta.apache.org
        ReportedBy: dschiff@us.ibm.com


PROBLEM DESCRIPTION:
====================
    Performing two occurances of the ant core task "jar" results in an 
    exception at the end of the second jar task/target:
        java.lang.NullPointerException
	  at org.apache.tools.zip.ZipOutputStream.finish
            (ZipOutputStream.java(Compiled Code))
	  at java.util.zip.DeflaterOutputStream.close
            (DeflaterOutputStream.java:139)
	  at org.apache.tools.ant.taskdefs.Zip.execute
            (Zip.java:402)
	  at org.apache.tools.ant.Task.perform
            (Task.java:317)
	  at org.apache.tools.ant.Target.execute
            (Target.java:309)
	  at org.apache.tools.ant.Target.performTasks
            (Target.java:334)
	  at org.apache.tools.ant.Project.executeTarget
            (Project.java:1306)
	  at org.apache.tools.ant.Project.executeTargets
            (Project.java:1250)
	  at org.apache.tools.ant.Main.runBuild
            (Main.java:610)
	  at org.apache.tools.ant.Main.start
            (Main.java:196)
	  at org.apache.tools.ant.Main.main
            (Main.java:235)

NOTES:
=============
    o This problem can be reproduced with ant 1.5 (July 9, 2002) and 
      ant 1.6 (August 19, 2002).

    o This problem does not occur with ant 1.4 (September 3, 2001).

    o  This problem does not occur if the jar task is performed only once.

    o This problem also occurs when calling the "zip" target multiple times.

STEPS TO REPRODUCE:
===================

    Test Preparation:
    1. Install ant 1.5.
    2. Create a directory named "antstuff".
    3. Copy the build.xml sample below into a file named "antstuff\build.xml".
    4. Copy the ant.properties sample below to a file named
       "antstuff\ant.properties"
    5. Create a directory named "antstuff\jars"
    6. Copy in to the "antstuff\jars" directory several jar files.

    Test Run:
    Failure:
    1. Open an MS-DOS command window.
    2. "cd" to the "antstuff" directory.
    3. Type the following into the MS-DOS command window:
       ant -debug -logfile antlog1.5_debug.log <enter>
    4. Allow the command to complete.
    5. Open the "antlog1.5_debug.log" file and note that the end of the file
       contains the exception.
    Success(1):
    6. Edit the antstuff\build.xml file and remove one of the dependent 
       targets in the "exceptions" target.
    7. Save this change.
    8. Repeat steps 1-4 above substituting "ant1.5a_debug.log" for the 
       logfile name. 
    9. Open the "antlog1.5a_debug.log" file and note that the script 
       ran successfully to completion.
    Success(2):
    10. Uninstall ant 1.5.
    11. Install ant 1.4.
    12. Restore the build.xml "exeception" target's depends list
        to "combine_jars,create_new_jar".
    13. Save this change.
    12. Repeat steps 1-4 above substituting "ant1.4_debug.log" for the 
        logfile name. 
    9. Open the "antlog1.4_debug.log" file and note that the script 
       ran successfully to completion.

SAMPLE TEST FILES:
==================

build.xml:
----------

<project name="zip_jar_test" default="exceptions" basedir=".">
  <property file="C:\antstuff\ant.properties"/>
  <target name="combine_jars">
    <!-- Create a temporary directory -->
    <mkdir dir="\temp\combined_jars"/>

    <!-- Unjar the specified jar files into the temporary directory:       -->
    <unjar src="${xmlapis}" dest="\temp\combined_jars"/>
    <unjar src="${optional}" dest="\temp\combined_jars"/>
    <unjar src="${xercesimpl}" dest="\temp\combined_jars"/>
    <unjar src="${ant}" dest="\temp\combined_jars"/>

    <!-- delete the manifest, stubs and ties files from the temp directory -->
    <delete dir="\temp\combined_jars\META-INF"/>

    <!-- Create the combined jar file of all files in the temp directory   -->
    <jar jarfile="jar1.jar" basedir="\temp\combined_jars"/>
  </target>

  <target name="create_new_jar">
    <mkdir dir="D:\junk"/>
    <delete dir="D:\junk"/>
    <jar jarfile="jar2.jar" basedir="d:\temp"/>
  </target>

  <target name="exceptions" depends="combine_jars,create_new_jar"/>

</project>







ant.properties
--------------
jar.dir=C:
xmlapis=${jar.dir}\\antstuff\\jars\\xml-apis.jar
optional=${jar.dir}\\antstuff\\jars\\optional.jar
xercesimpl=${jar.dir}\\antstuff\\jars\\xercesImpl.jar
ant=${jar.dir}\\antstuff\\jars\\ant.jar

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>