manifest.getMainAttributes().getValue(Attributes.Name.CLASS_PATH.toString()); if (classpathAttribute != null) { for (String path : CLASS_PATH_ATTRIBUTE_SEPARATOR.split(classpathAttribute)) {
manifest.getMainAttributes().getValue(Attributes.Name.CLASS_PATH.toString()); if (classpathAttribute != null) { for (String path : CLASS_PATH_ATTRIBUTE_SEPARATOR.split(classpathAttribute)) {
String attrName = ((Attributes.Name) it.next()).toString(); boolean skip = false;
@Test public void testHasOsgiManifestWhenInvalidManifest() throws Exception { Map<String, String> manifest = ImmutableMap.of(Attributes.Name.MANIFEST_VERSION.toString(), "1.2.3", "mykey", "myval"); generatedJar = bundleMaker.copyAddingManifest(emptyJar, manifest); assertFalse(bundleMaker.hasOsgiManifest(generatedJar)); }
Object getAttribute(final Name attrName) throws FileSystemException { try { final Attributes attr = getAttributes(); final String value = attr.getValue(attrName); return value; } catch (final IOException ioe) { throw new FileSystemException(attrName.toString(), ioe); } }
/** * Returns an attribute of the package containing the resource. */ public String getPackageAttribute(final Attributes.Name attrName) throws FileSystemException { return (String) packageFolder.getContent().getAttribute(attrName.toString()); }
Name name = (Name) hint; hints.put(Hints.EPSG_DATA_SOURCE, name); datasourceName = name.toString();
for(Object attrkey: entry.getValue().keySet()) { if (attrkey instanceof Attributes.Name && ((Attributes.Name)attrkey).toString().indexOf("-Digest") != -1) signed.add(entry.getKey());
} else if (key.equalsIgnoreCase(Attributes.Name.IMPLEMENTATION_TITLE.toString())) { foundSomething = true; dependency.addEvidence(EvidenceType.PRODUCT, source, key, value, Confidence.HIGH); addMatchingValues(classInformation, value, dependency, EvidenceType.PRODUCT); } else if (key.equalsIgnoreCase(Attributes.Name.IMPLEMENTATION_VERSION.toString())) { hasImplementationVersion = true; foundSomething = true; } else if ("specification-version".equalsIgnoreCase(key)) { specificationVersion = value; } else if (key.equalsIgnoreCase(Attributes.Name.IMPLEMENTATION_VENDOR.toString())) { foundSomething = true; dependency.addEvidence(EvidenceType.VENDOR, source, key, value, Confidence.HIGH); foundSomething = true; dependency.addEvidence(EvidenceType.VERSION, source, key, value, Confidence.HIGH); } else if (key.equalsIgnoreCase(Attributes.Name.MAIN_CLASS.toString())) { final String key = entry.getKey().toString(); final String value = atts.getValue(key); if (key.equalsIgnoreCase(Attributes.Name.IMPLEMENTATION_TITLE.toString())) { foundSomething = true; dependency.addEvidence(EvidenceType.PRODUCT, source, key, value, Confidence.MEDIUM); addMatchingValues(classInformation, value, dependency, EvidenceType.PRODUCT); } else if (key.equalsIgnoreCase(Attributes.Name.IMPLEMENTATION_VERSION.toString())) { foundSomething = true; dependency.addEvidence(EvidenceType.VERSION, source, key, value, Confidence.MEDIUM); } else if (key.equalsIgnoreCase(Attributes.Name.IMPLEMENTATION_VENDOR.toString())) { foundSomething = true;
while (it.hasNext()) { java.util.Map.Entry<Object, Object> entry = it.next(); String attrName = ((Attributes.Name) entry.getKey()).toString(); ret.put(attrName, entry.getValue().toString()); while (it.hasNext()) { java.util.Map.Entry<Object, Object> entry = it.next(); String attrName = ((Attributes.Name) entry.getKey()).toString();
strManifest += "Manifest-Version: 1.0" + Const.CR; strManifest += "Created-By: Kettle version " + BuildVersion.getInstance().getVersion() + Const.CR; strManifest += Attributes.Name.MAIN_CLASS.toString() + ": " + ( JarPan.class.getName() ) + Const.CR;
manifest.getMainAttributes().getValue(Attributes.Name.CLASS_PATH.toString()); if (classpathAttribute != null) { for (String path : CLASS_PATH_ATTRIBUTE_SEPARATOR.split(classpathAttribute)) {
/** * Returns the class path URIs specified by the {@code Class-Path} manifest attribute, according * to <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#Main%20Attributes"> * JAR File Specification</a>. If {@code manifest} is null, it means the jar file has no * manifest, and an empty set will be returned. */ static Set<URI> getClassPathFromManifest( File jarFile, Manifest manifest) { if (manifest == null) { return new HashSet<>(); } Set<URI> builder = new HashSet<>(); String classpathAttribute = manifest.getMainAttributes() .getValue(Attributes.Name.CLASS_PATH.toString()); if (classpathAttribute != null) { for (String path : classpathAttribute.split(" ")) { URI uri; try { uri = getClassPathEntry(jarFile, path); } catch (URISyntaxException e) { // Ignore bad entry continue; } builder.add(uri); } } return builder; }
manifest.getMainAttributes().getValue(Attributes.Name.CLASS_PATH.toString()); if (classpathAttribute != null) { for (String path : CLASS_PATH_ATTRIBUTE_SEPARATOR.split(classpathAttribute)) {
public static void writeMainSection(OutputStream out, Attributes attributes) throws IOException { // Main section must start with the Signature-Version attribute. // See https://docs.oracle.com/javase/8/docs/technotes/guides/jar/jar.html#Signed_JAR_File. String signatureVersion = attributes.getValue(Attributes.Name.SIGNATURE_VERSION); if (signatureVersion == null) { throw new IllegalArgumentException( "Mandatory " + Attributes.Name.SIGNATURE_VERSION + " attribute missing"); } ManifestWriter.writeAttribute(out, Attributes.Name.SIGNATURE_VERSION, signatureVersion); if (attributes.size() > 1) { SortedMap<String, String> namedAttributes = ManifestWriter.getAttributesSortedByName(attributes); namedAttributes.remove(Attributes.Name.SIGNATURE_VERSION.toString()); ManifestWriter.writeAttributes(out, namedAttributes); } writeSectionDelimiter(out); }
/** * Find a localized and/or branded value in a JAR manifest in the default system locale. * @param attr the manifest attributes * @param key the key to look for (case-insensitive) * @return the value if found, else <code>null</code> */ public static String getLocalizedValue(Attributes attr, Attributes.Name key) { // Yes, US locale is intentional! The attribute name may only be ASCII anyway. // It is necessary to lowercase it *as ASCII* as in Turkish 'I' does not go to 'i'! return getLocalizedValue(attr2Map(attr), key.toString().toLowerCase(Locale.US)); }
/** * Find a localized and/or branded value in a JAR manifest. * @param attr the manifest attributes * @param key the key to look for (case-insensitive) * @param locale the locale to use * @return the value if found, else <code>null</code> */ public static String getLocalizedValue(Attributes attr, Attributes.Name key, Locale locale) { return getLocalizedValue(attr2Map(attr), key.toString().toLowerCase(Locale.US), locale); }
public static void writeMainSection(OutputStream out, Attributes attributes) throws IOException { // Main section must start with the Manifest-Version attribute. // See https://docs.oracle.com/javase/8/docs/technotes/guides/jar/jar.html#Signed_JAR_File. String manifestVersion = attributes.getValue(Attributes.Name.MANIFEST_VERSION); if (manifestVersion == null) { throw new IllegalArgumentException( "Mandatory " + Attributes.Name.MANIFEST_VERSION + " attribute missing"); } writeAttribute(out, Attributes.Name.MANIFEST_VERSION, manifestVersion); if (attributes.size() > 1) { SortedMap<String, String> namedAttributes = getAttributesSortedByName(attributes); namedAttributes.remove(Attributes.Name.MANIFEST_VERSION.toString()); writeAttributes(out, namedAttributes); } writeSectionDelimiter(out); }
static void writeAttribute(OutputStream out, Attributes.Name name, String value) throws IOException { writeAttribute(out, name.toString(), value); }