Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
BundleDescriptorImpl fails to load the manifest if the URL for the bundle points at a folder as it assumes the URL passed in points at a jar file.
I noticed this while trying to add an it-testing aggregate feature so a bundle could test itself in an integration test. In this scenario, the URL for the local bundle gets passed to the BundleDescriptorImpl as a file URL pointing at the target/classes folder and fails the analyze-feature goal with this error:
Caused by: java.io.FileNotFoundException: /home/projects/sling-org-apache-sling-jcr-maintenance/target/classes (Is a directory) at java.io.RandomAccessFile.open0 (Native Method) at java.io.RandomAccessFile.open (RandomAccessFile.java:345) at java.io.RandomAccessFile.<init> (RandomAccessFile.java:259) at java.io.RandomAccessFile.<init> (RandomAccessFile.java:214) at java.util.zip.ZipFile$Source.<init> (ZipFile.java:1285) at java.util.zip.ZipFile$Source.get (ZipFile.java:1251) at java.util.zip.ZipFile$CleanableResource.<init> (ZipFile.java:732) at java.util.zip.ZipFile$CleanableResource.get (ZipFile.java:849) at java.util.zip.ZipFile.<init> (ZipFile.java:247) at java.util.zip.ZipFile.<init> (ZipFile.java:177) at java.util.jar.JarFile.<init> (JarFile.java:348) at java.util.jar.JarFile.<init> (JarFile.java:319) at java.util.jar.JarFile.<init> (JarFile.java:285) at org.apache.sling.feature.io.IOUtils.getJarFileFromURL (IOUtils.java:242) at org.apache.sling.feature.scanner.impl.BundleDescriptorImpl.getManifest (BundleDescriptorImpl.java:75) at org.apache.sling.feature.scanner.impl.BundleDescriptorImpl.<init> (BundleDescriptorImpl.java:83) at org.apache.sling.feature.scanner.Scanner.doScan (Scanner.java:146) at org.apache.sling.feature.scanner.Scanner.scanBundle (Scanner.java:117) at org.apache.sling.feature.scanner.Scanner.getBundleInfos (Scanner.java:162) at org.apache.sling.feature.scanner.Scanner.scan (Scanner.java:227) at org.apache.sling.feature.analyser.Analyser.analyse (Analyser.java:188) at org.apache.sling.feature.maven.mojos.AnalyseFeaturesMojo.execute (AnalyseFeaturesMojo.java:157) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
Expected that the BundleDescriptorImpl should check if the address is a file url pointing at a local directory and try to load the META-INF/MANIFEST.MF as a file within that directory.