You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2014/01/04 18:21:19 UTC

svn commit: r1555374 - /maven/shared/trunk/maven-jarsigner/src/main/java/org/apache/maven/shared/jarsigner/JarSignerUtil.java

Author: hboutemy
Date: Sat Jan  4 17:21:18 2014
New Revision: 1555374

URL: http://svn.apache.org/r1555374
Log:
be more strict: digest entry key *ends with* -Digest, not only contains

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=1555374&r1=1555373&r2=1555374&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 Sat Jan  4 17:21:18 2014
@@ -147,29 +147,31 @@ public class JarSignerUtil
      */
     protected static Manifest buildUnsignedManifest( Manifest manifest )
     {
-
         Manifest result = new Manifest( manifest );
         result.getEntries().clear();
 
-        for ( Map.Entry<String, Attributes> entry : manifest.getEntries().entrySet() )
+        for ( Map.Entry<String, Attributes> manifestEntry : manifest.getEntries().entrySet() )
         {
-            Attributes oldAttributes = entry.getValue();
+            Attributes oldAttributes = manifestEntry.getValue();
             Attributes newAttributes = new Attributes();
-            for ( Map.Entry<Object, Object> objectEntry : oldAttributes.entrySet() )
+
+            for ( Map.Entry<Object, Object> attributesEntry : oldAttributes.entrySet() )
             {
-                String attributeKey = String.valueOf( objectEntry.getKey() );
-                if ( !attributeKey.contains( "-Digest" ) )
+                String attributeKey = String.valueOf( attributesEntry.getKey() );
+                if ( !attributeKey.endsWith( "-Digest" ) )
                 {
                     // can add this attribute
-                    newAttributes.put( objectEntry.getKey(), objectEntry.getValue() );
+                    newAttributes.put( attributesEntry.getKey(), attributesEntry.getValue() );
                 }
             }
+
             if ( !newAttributes.isEmpty() )
             {
                 // can add this entry
-                result.getEntries().put( entry.getKey(), newAttributes );
+                result.getEntries().put( manifestEntry.getKey(), newAttributes );
             }
         }
+
         return result;
     }