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 -> { + } } 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