Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 70000 invoked from network); 14 Sep 2002 21:44:33 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 14 Sep 2002 21:44:33 -0000 Received: (qmail 12006 invoked by uid 97); 14 Sep 2002 21:45:12 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 11962 invoked by uid 97); 14 Sep 2002 21:45:11 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 11935 invoked by uid 50); 14 Sep 2002 21:45:11 -0000 Date: 14 Sep 2002 21:45:11 -0000 Message-ID: <20020914214511.11934.qmail@nagoya.betaversion.org> From: bugzilla@apache.org To: ant-dev@jakarta.apache.org Cc: Subject: DO NOT REPLY [Bug 12651] New: - jar update with manifest does not merge manifests X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . 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=12651 jar update with manifest does not merge manifests Summary: jar update with manifest does not merge manifests Product: Ant Version: 1.5 Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: Core tasks AssignedTo: ant-dev@jakarta.apache.org ReportedBy: bjenkins@dynamicsoft.com Steps to dupe: 1. Create a jar with a few entries 2. Sign the jar using the signjar task 3. Update the jar with a specified manifest containing at least one section with entries 4. The specified manifest replaces the original manifest containing the SHA1- Digest for the signed files To fix the problem, I made the following modification to the Jar task: 1. Add a Manifest reference to the Jar task private Manifest originalManifest; 2. Override the setDestFile(File) method to grab the original manifest public void setDestFile(File destFile) { super.setDestFile(destFile); try { JarFile jf = new JarFile(destFile); ByteArrayOutputStream out = new ByteArrayOutputStream(); jf.getManifest().write(out); jf.close(); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); originalManifest = new Manifest(new InputStreamReader(in)); } catch (Throwable t) { originalManifest = null; } } 3. Modify the createManifest() method to use the originalManifest private Manifest createManifest() throws IOException, BuildException { try { Manifest finalManifest = null; // changed if (originalManifest != null && this.isInUpdateMode()) // changed finalManifest = originalManifest; // changed else finalManifest = Manifest.getDefaultManifest(); // changed if (manifest == null) { -- To unsubscribe, e-mail: For additional commands, e-mail: