This is an automated email from the ASF dual-hosted git repository. fmariani pushed a commit to branch camel-3.20.x in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.20.x by this push: new d601d407cfd Safe download artifacts d601d407cfd is described below commit d601d407cfd96e8b1e400de132506e57e905ba35 Author: Croway <federico.mariani.1...@gmail.com> AuthorDate: Thu Mar 16 16:57:20 2023 +0100 Safe download artifacts --- .../main/download/MavenDependencyDownloader.java | 36 +++++++++++++--------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/MavenDependencyDownloader.java b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/MavenDependencyDownloader.java index f1525fdfc66..e246e077347 100644 --- a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/MavenDependencyDownloader.java +++ b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/MavenDependencyDownloader.java @@ -1364,24 +1364,30 @@ public class MavenDependencyDownloader extends ServiceSupport implements Depende } else { repos = List.of(remoteRepositories.get(0), repository); } - List<MavenArtifact> artifacts = resolveDependenciesViaAether(List.of(gav), repos, false); - if (!artifacts.isEmpty()) { - MavenArtifact ma = artifacts.get(0); - if (ma != null && ma.getFile() != null) { - String name = ma.getFile().getAbsolutePath(); - File file = new File(name); - if (file.exists()) { - DocumentBuilderFactory dbf = XmlHelper.createDocumentBuilderFactory(); - DocumentBuilder db = dbf.newDocumentBuilder(); - Document dom = db.parse(file); - // the camel version is in <parent> - NodeList nl = dom.getElementsByTagName("parent"); - if (nl.getLength() == 1) { - Element node = (Element) nl.item(0); - return node.getElementsByTagName("version").item(0).getTextContent(); + + try { + List<MavenArtifact> artifacts = resolveDependenciesViaAether(List.of(gav), repos, false); + if (!artifacts.isEmpty()) { + MavenArtifact ma = artifacts.get(0); + if (ma != null && ma.getFile() != null) { + String name = ma.getFile().getAbsolutePath(); + File file = new File(name); + if (file.exists()) { + DocumentBuilderFactory dbf = XmlHelper.createDocumentBuilderFactory(); + DocumentBuilder db = dbf.newDocumentBuilder(); + Document dom = db.parse(file); + // the camel version is in <parent> + NodeList nl = dom.getElementsByTagName("parent"); + if (nl.getLength() == 1) { + Element node = (Element) nl.item(0); + return node.getElementsByTagName("version").item(0).getTextContent(); + } } } } + } catch (DownloadException ex) { + // Artifact may not exist on repository, just skip it + LOG.debug(ex.getMessage(), ex); } return null;