protected String getBundleSymbolicName()

in src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleRequestMojo.java [152:177]


    protected String getBundleSymbolicName(File jarFile) {

        if (!jarFile.exists()) {
            return null;
        }

        try (JarFile jaf = new JarFile(jarFile)) {
            Manifest manif = jaf.getManifest();
            if (manif == null) {
                getLog().debug("getBundleSymbolicName: Missing manifest in " + jarFile);
                return null;
            }

            String symbName = manif.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME);
            if (symbName == null) {
                getLog().debug("getBundleSymbolicName: No Bundle-SymbolicName in " + jarFile);
                return null;
            }

            return symbName;
        } catch (IOException ioe) {
            getLog().warn("getBundleSymbolicName: Problem checking " + jarFile, ioe);
        }
        // fall back to not being a bundle
        return null;
    }