protected static Manifest buildUnsignedManifest()

in src/main/java/org/apache/maven/shared/jarsigner/JarSignerUtil.java [117:140]


    protected static Manifest buildUnsignedManifest(Manifest manifest) {
        Manifest result = new Manifest(manifest);
        result.getEntries().clear();

        for (Map.Entry<String, Attributes> manifestEntry : manifest.getEntries().entrySet()) {
            Attributes oldAttributes = manifestEntry.getValue();
            Attributes newAttributes = new Attributes();

            for (Map.Entry<Object, Object> attributesEntry : oldAttributes.entrySet()) {
                String attributeKey = String.valueOf(attributesEntry.getKey());
                if (!attributeKey.endsWith("-Digest")) {
                    // can add this attribute
                    newAttributes.put(attributesEntry.getKey(), attributesEntry.getValue());
                }
            }

            if (!newAttributes.isEmpty()) {
                // can add this entry
                result.getEntries().put(manifestEntry.getKey(), newAttributes);
            }
        }

        return result;
    }