private static boolean isSigned(final Manifest manifest) { Section section = manifest.getSection(MANIFEST); if (section != null) { final Enumeration<String> sectionKeys = (Enumeration<String>) section.getAttributeKeys(); while (sectionKeys.hasMoreElements()) { if (sectionKeys.nextElement().endsWith("-Digest")) { //NOI18N return true; } } } return false; }
private void addSectionAttributesToAnt(Manifest antManifest) { for (Map.Entry<String, Attributes> entry : sections.entrySet()) { Section section = new Section(); section.setName(entry.getKey()); try { antManifest.addConfiguredSection(section); for (Map.Entry<String, Object> attributeEntry : entry.getValue().entrySet()) { section.addConfiguredAttribute(new Attribute(attributeEntry.getKey(), attributeEntry.getValue().toString())); } } catch (ManifestException e) { throw new org.gradle.api.java.archives.ManifestException(e.getMessage(), e); } } }
private void addSectionAttributesToAnt(Manifest antManifest) { for (Map.Entry<String, Attributes> entry : sections.entrySet()) { Section section = new Section(); section.setName(entry.getKey()); try { antManifest.addConfiguredSection(section); for (Map.Entry<String, Object> attributeEntry : entry.getValue().entrySet()) { section.addConfiguredAttribute(new Attribute(attributeEntry.getKey().toString(), attributeEntry.getValue().toString())); } } catch (ManifestException e) { throw new org.gradle.api.java.archives.ManifestException(e.getMessage(), e); } } }
/** * Check against packaging spec * @see "http://java.sun.com/j2se/1.3/docs/guide/versioning/spec/VersioningSpecification.html#PackageVersioning" */ // CheckStyle:LineLength ON private void checkJarSpec() { String br = System.getProperty("line.separator"); StringBuilder message = new StringBuilder(); Section mainSection = (configuredManifest == null) ? null : configuredManifest.getMainSection(); if (mainSection == null) { message.append("No Implementation-Title set."); message.append("No Implementation-Version set."); message.append("No Implementation-Vendor set."); } else { if (mainSection.getAttribute("Implementation-Title") == null) { message.append("No Implementation-Title set."); } if (mainSection.getAttribute("Implementation-Version") == null) { message.append("No Implementation-Version set."); } if (mainSection.getAttribute("Implementation-Vendor") == null) { message.append("No Implementation-Vendor set."); } } if (message.length() > 0) { message.append(br); message.append("Location: ").append(getLocation()); message.append(br); if ("fail".equalsIgnoreCase(strict.getValue())) { throw new BuildException(message.toString(), getLocation()); } logWhenWriting(message.toString(), strict.getLogLevel()); } }