maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tche...@apache.org
Subject svn commit: r1540158 - in /maven/shared/trunk/maven-jarsigner/src: main/java/org/apache/maven/shared/jarsigner/JarSignerUtil.java test/java/org/apache/maven/shared/jarsigner/JarSignerUtilTest.java test/javax.persistence_2.0.5.v201212031355.jar
Date Fri, 08 Nov 2013 19:35:24 GMT
Author: tchemit
Date: Fri Nov  8 19:35:23 2013
New Revision: 1540158

URL: http://svn.apache.org/r1540158
Log:
MSHARED-277 - JarSignerUtil.unsignArchive invalid entry compressed size
Submitted by: Timo Meinen timomeinen@gmail.com
Comment: Add a junit test to test it

Added:
    maven/shared/trunk/maven-jarsigner/src/test/java/org/apache/maven/shared/jarsigner/JarSignerUtilTest.java
  (with props)
    maven/shared/trunk/maven-jarsigner/src/test/javax.persistence_2.0.5.v201212031355.jar
  (with props)
Modified:
    maven/shared/trunk/maven-jarsigner/src/main/java/org/apache/maven/shared/jarsigner/JarSignerUtil.java

Modified: maven/shared/trunk/maven-jarsigner/src/main/java/org/apache/maven/shared/jarsigner/JarSignerUtil.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-jarsigner/src/main/java/org/apache/maven/shared/jarsigner/JarSignerUtil.java?rev=1540158&r1=1540157&r2=1540158&view=diff
==============================================================================
--- maven/shared/trunk/maven-jarsigner/src/main/java/org/apache/maven/shared/jarsigner/JarSignerUtil.java
(original)
+++ maven/shared/trunk/maven-jarsigner/src/main/java/org/apache/maven/shared/jarsigner/JarSignerUtil.java
Fri Nov  8 19:35:23 2013
@@ -104,7 +104,7 @@ public class JarSignerUtil
                     continue;
                 }
 
-                zos.putNextEntry( ze );
+                zos.putNextEntry(new ZipEntry(ze.getName()));
 
                 IOUtil.copy( zis, zos );
             }

Added: maven/shared/trunk/maven-jarsigner/src/test/java/org/apache/maven/shared/jarsigner/JarSignerUtilTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-jarsigner/src/test/java/org/apache/maven/shared/jarsigner/JarSignerUtilTest.java?rev=1540158&view=auto
==============================================================================
--- maven/shared/trunk/maven-jarsigner/src/test/java/org/apache/maven/shared/jarsigner/JarSignerUtilTest.java
(added)
+++ maven/shared/trunk/maven-jarsigner/src/test/java/org/apache/maven/shared/jarsigner/JarSignerUtilTest.java
Fri Nov  8 19:35:23 2013
@@ -0,0 +1,60 @@
+package org.apache.maven.shared.jarsigner;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.TestCase;
+import org.apache.maven.shared.utils.io.FileUtils;
+
+import java.io.File;
+
+/**
+ * Created on 11/8/13.
+ *
+ * @author Tony Chemit <chemit@codelutin.com>
+ * @version $Id$
+ * @since 1.1
+ */
+public class JarSignerUtilTest
+    extends TestCase
+{
+
+    // Fix MSHARED-277
+    public void testUnsignArchive()
+        throws Exception
+    {
+
+        File file = new File( "src/test/javax.persistence_2.0.5.v201212031355.jar" );
+        File target = new File( "target/", file.getName() );
+
+        if ( target.exists() )
+        {
+            FileUtils.forceDelete( target );
+        }
+
+        FileUtils.copyFile( file, target );
+
+        assertTrue( JarSignerUtil.isArchiveSigned( target ) );
+
+        JarSignerUtil.unsignArchive( target );
+
+        assertFalse( JarSignerUtil.isArchiveSigned( target ) );
+
+    }
+}

Propchange: maven/shared/trunk/maven-jarsigner/src/test/java/org/apache/maven/shared/jarsigner/JarSignerUtilTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/shared/trunk/maven-jarsigner/src/test/java/org/apache/maven/shared/jarsigner/JarSignerUtilTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/shared/trunk/maven-jarsigner/src/test/javax.persistence_2.0.5.v201212031355.jar
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-jarsigner/src/test/javax.persistence_2.0.5.v201212031355.jar?rev=1540158&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/shared/trunk/maven-jarsigner/src/test/javax.persistence_2.0.5.v201212031355.jar
------------------------------------------------------------------------------
    svn:mime-type = application/zip



Mime
View raw message