bazaarvoice / jolt

JSON to JSON transformation library written in Java.
Apache License 2.0
1.56k stars 329 forks source link

Support Classloader hierarchy in getResource #1171

Open glassfox opened 2 years ago

glassfox commented 2 years ago

When loading resource from classpath, current process are:

InputStream inputStream = this.getClass().getResourceAsStream( classPath );

This typo suitable only when actual Resource and Jolt jar managed with the same Classloader. In case when Resource managed by another ClassLoader, more suitable to use:

ClassLoader cl = Thread.currentThread().getContextClassLoader();
InputStream inputStream = cl.getResourceAsStream( classPath );