1. jhove2
  2. main
  3. Issues


Issue #154 new

FeatureConfigurationUtil.getFilePathFromClasspath uses SystemClassloader

Justin Littman
created an issue

fileURI = ClassLoader.getSystemResource(fileName).toURI(); is problematic if an alternate classloader is used.

In my case, the system class loader is not the actual classloader: log.info(ClassLoader.getSystemClassLoader().toString()); log.info(this.getClass().getClassLoader().toString()); yields: 2012-05-10 09:22:48,720 [qtp22527820-73] INFO IdentifyComponent : sun.misc.Launcher$AppClassLoader@16f0472 2012-05-10 09:22:48,720 [qtp22527820-73] INFO IdentifyComponent : org.codehaus.classworlds.RealmClassLoader@7ffe01

Also, the way this is written if the SystemResource is not found, a NPE is thrown.