On 09/09/2010 10:20 AM, Rene Scheibe wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Just a short question. When resolving the URL for a resource via
UtilUrl.fromResource(String resourceName, ClassLoader loader) why is it
implemented that the most specific match is the last one? See below?

if (url == null) url = loader.getResource(resourceName);
if (url == null) url = loader.getResource(resourceName + ".properties");

This results in a problem, when eg. calling
UtilProperties.getPropertyValue("catalog", "image.server.path").
Scenario: I have another jar in the classpath that contains a "catalog"
folder. I expect to get the property from catalog.properties but the
result is a "catalog" URL from my other jar, which does not include
anything useful and results in NullPointerExceptions in OFBiz.

The bug here is not the ordering of those lines, but the calling code requesting just 'catalog'. The calling code should directly request 'catalog.properties'.

There was a similiar bug years(ages) ago, where calling code requested 'security', instead of 'security.properties'. As you can imagine, 'security' is a rather general term, and it clashed with other locations.

Reply via email to