imagen icon indicating copy to clipboard operation
imagen copied to clipboard

PropertyUtils.getFileFromClasspath results in null stream in JPMS

Open wcole3 opened this issue 1 month ago • 1 comments

The PropertyUtils.getFileFromClasspath() lookup results in a null stream being returned when imagen-core.jar is on the module-path. The internal call to getResourceAsStream() will work when the imagen-core jar is on the classpath (and hence in the unnamed module), but if they are on the module-path it is treated as an automatic module.

The null returned stream can result in a failure to initialize ImageN, observed failures during the OperationRegistry initialization's process for registering descriptors, the process fails to correctly find the ***.properties resource files for jars outside of imagen-core (we observed this for the affine module specifically, but expect the same behavior for resource files outside of imagen-core). This should be a potential problem for all location that calls PropertyUtil.getString().

Possibly a fallback block of logic in PropertyUtils to use the context or system classloader if the getResourceAsStream call fails or alternatively pass an optional Class/ClassLoader in to use when the call to getFileFromClasspath/getString comes from a module outside of imagen-core.

If ImageN is not intended to be compatible with the module system, I'm happy to close the issue.

wcole3 avatar Nov 18 '25 01:11 wcole3