bazaarvoice / jolt

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

Support Classloader hierarchy in getResource #1171

Open glassfox opened 1 year ago

glassfox commented 1 year 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 );