From 7543bd15f112362f1b769f0b59be66c0252bcead Mon Sep 17 00:00:00 2001 From: "igor.petrenko" Date: Tue, 27 Feb 2024 18:55:47 +0200 Subject: [PATCH 1/2] OAP-246 fix: java.nio.file.FileSystemNotFoundException --- .../HoconFactoryWithSystemProperties.java | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/oap-stdlib/src/main/java/oap/json/HoconFactoryWithSystemProperties.java b/oap-stdlib/src/main/java/oap/json/HoconFactoryWithSystemProperties.java index cc84aa04a4..691be8a8ff 100644 --- a/oap-stdlib/src/main/java/oap/json/HoconFactoryWithSystemProperties.java +++ b/oap-stdlib/src/main/java/oap/json/HoconFactoryWithSystemProperties.java @@ -56,18 +56,26 @@ protected HoconTreeTraversingParser _createParser( Reader r, IOContext ctxt ) th var options = ConfigParseOptions.defaults(); Object rawContent = ctxt.contentReference().getRawContent(); - if( rawContent instanceof URL urlContext ) { - URL parentURL = Paths.get( urlContext.toURI() ).getParent().toUri().toURL(); + log.trace( "rawContent {} rawContentClazz {}", rawContent, rawContent.getClass() ); - options = options.setClassLoader( new URLClassLoader( new URL[] { parentURL } ) ); - } else if( rawContent instanceof File fileContext ) { - URL parentURL = Paths.get( fileContext.toURI() ).getParent().toUri().toURL(); - - options = options.setClassLoader( new URLClassLoader( new URL[] { parentURL } ) ); - } else if( rawContent instanceof URI uriContext ) { - URL parentURL = Paths.get( uriContext ).getParent().toUri().toURL(); - - options = options.setClassLoader( new URLClassLoader( new URL[] { parentURL } ) ); + switch( rawContent ) { + case URL urlContext -> { + URL parentURL = urlContext.toURI().resolve( "" ).toURL(); + log.trace( "parentURL {}", parentURL ); + options = options.setClassLoader( new URLClassLoader( new URL[] { parentURL } ) ); + } + case File fileContext -> { + URL parentURL = Paths.get( fileContext.toURI() ).getParent().toUri().toURL(); + log.trace( "parentURL {}", parentURL ); + options = options.setClassLoader( new URLClassLoader( new URL[] { parentURL } ) ); + } + case URI uriContext -> { + URL parentURL = uriContext.resolve( "" ).toURL(); + log.trace( "parentURL {}", parentURL ); + options = options.setClassLoader( new URLClassLoader( new URL[] { parentURL } ) ); + } + default -> { + } } From 304ee0220194f0f219c0e660c2844944c2807d34 Mon Sep 17 00:00:00 2001 From: "igor.petrenko" Date: Tue, 27 Feb 2024 19:21:24 +0200 Subject: [PATCH 2/2] OAP-246 fix: java.nio.file.FileSystemNotFoundException --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4911e72d90..47b0bf71ed 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,7 @@ - 21.15.2 + 21.15.3 21.0.0 21.0.1