Skip to content

Commit

Permalink
OAP-246 fix: java.nio.file.FileSystemNotFoundException
Browse files Browse the repository at this point in the history
  • Loading branch information
nofateg authored Feb 27, 2024
1 parent 714729e commit 8b232cd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 -> {
}
}


Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</repositories>

<properties>
<oap.project.version>21.15.2</oap.project.version>
<oap.project.version>21.15.3</oap.project.version>

<oap.deps.config.version>21.0.0</oap.deps.config.version>
<oap.deps.oap-teamcity.version>21.0.1</oap.deps.oap-teamcity.version>
Expand Down

0 comments on commit 8b232cd

Please sign in to comment.