From 057dd12b83f603f1f5ae914f150fe528c0efd7f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Tue, 21 Jan 2025 06:19:00 +0100 Subject: [PATCH] Catch OsgiManifestParserException in maven artifact provider Maven artifacts are not required to be valid bundles, in such case a OsgiManifestParserException can be thrown when query for the package version that then fails the build. This now catches OsgiManifestParserException to prevent the issue from happening. (cherry picked from commit ffbcbae748012c3cc9b3e259436b55064a598ce8) --- .../baseline/provider/MavenArtifactVersionProvider.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tycho-baseline-plugin/src/main/java/org/eclipse/tycho/baseline/provider/MavenArtifactVersionProvider.java b/tycho-baseline-plugin/src/main/java/org/eclipse/tycho/baseline/provider/MavenArtifactVersionProvider.java index 619a52ff0e..90a02bc286 100644 --- a/tycho-baseline-plugin/src/main/java/org/eclipse/tycho/baseline/provider/MavenArtifactVersionProvider.java +++ b/tycho-baseline-plugin/src/main/java/org/eclipse/tycho/baseline/provider/MavenArtifactVersionProvider.java @@ -45,6 +45,7 @@ import org.eclipse.tycho.artifacts.ArtifactVersionProvider; import org.eclipse.tycho.core.osgitools.BundleReader; import org.eclipse.tycho.core.osgitools.OsgiManifest; +import org.eclipse.tycho.core.osgitools.OsgiManifestParserException; import org.osgi.framework.BundleException; import org.osgi.framework.VersionRange; import org.osgi.framework.namespace.PackageNamespace; @@ -165,10 +166,10 @@ public String getProvider() { private ModuleRevisionBuilder readOSGiInfo(Path path) { if (path != null) { - OsgiManifest manifest = bundleReader.loadManifest(path.toFile()); try { + OsgiManifest manifest = bundleReader.loadManifest(path.toFile()); return OSGiManifestBuilderFactory.createBuilder(manifest.getHeaders()); - } catch (BundleException e) { + } catch (BundleException | OsgiManifestParserException e) { } } return null;