List of usage examples for org.apache.commons.io.manifest ManifestUtils loadManifest
public static final Manifest loadManifest(URL url) throws IOException
From source file:net.community.chest.gitcloud.facade.AbstractContextInitializer.java
protected void scanArtifactsManifests(Predicate<Pair<URL, Manifest>> manifestHandler) { ClassLoader loader = ExtendedClassUtils.getDefaultClassLoader(getClass()); try {/*ww w . java 2 s . c om*/ for (Enumeration<URL> manifests = loader.getResources(JarFile.MANIFEST_NAME); (manifests != null) && manifests.hasMoreElements();) { URL url = manifests.nextElement(); try { Manifest manifest = ManifestUtils.loadManifest(url); if (manifestHandler.evaluate(Pair.of(url, manifest))) { logger.info("Scanning stopped by handler at URL=" + url.toExternalForm()); break; } } catch (Exception e) { logger.warn(e.getClass().getSimpleName() + " while handle URL=" + url.toExternalForm() + ": " + e.getMessage()); } } } catch (IOException e) { logger.warn("Failed (" + e.getClass().getSimpleName() + ") to get manifests URLs: " + e.getMessage()); } }