This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit b80892832b7a9196f2e75fc1c6bb690cbe50302d Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Fri Sep 3 17:46:33 2021 +0200 CAMEL-16918: camel-datasonnet - Do not use deprecated API --- .../camel/language/datasonnet/DatasonnetLanguage.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/components/camel-datasonnet/src/main/java/org/apache/camel/language/datasonnet/DatasonnetLanguage.java b/components/camel-datasonnet/src/main/java/org/apache/camel/language/datasonnet/DatasonnetLanguage.java index ce2b943..b42be46 100644 --- a/components/camel-datasonnet/src/main/java/org/apache/camel/language/datasonnet/DatasonnetLanguage.java +++ b/components/camel-datasonnet/src/main/java/org/apache/camel/language/datasonnet/DatasonnetLanguage.java @@ -16,6 +16,7 @@ */ package org.apache.camel.language.datasonnet; +import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.HashMap; @@ -46,12 +47,16 @@ public class DatasonnetLanguage extends LanguageSupport implements PropertyConfi static { LOG.debug("One time classpath search..."); - try (ScanResult scanResult = new ClassGraph().whitelistPaths("/").scan()) { - scanResult.getResourcesWithExtension("libsonnet") - .forEachByteArray((resource, bytes) -> { - LOG.debug("Loading DataSonnet library: {}", resource.getPath()); - CLASSPATH_IMPORTS.put(resource.getPath(), new String(bytes, StandardCharsets.UTF_8)); - }); + try (ScanResult scanResult = new ClassGraph().acceptPaths("/").scan()) { + try { + scanResult.getResourcesWithExtension("libsonnet") + .forEachByteArrayThrowingIOException((resource, bytes) -> { + LOG.debug("Loading DataSonnet library: {}", resource.getPath()); + CLASSPATH_IMPORTS.put(resource.getPath(), new String(bytes, StandardCharsets.UTF_8)); + }); + } catch (IOException e) { + // ignore + } } LOG.debug("One time classpath search done"); }