db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-4815) Override mechanism for modules.properties works backwards
Date Tue, 26 Oct 2010 09:39:23 GMT

     [ https://issues.apache.org/jira/browse/DERBY-4815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Knut Anders Hatlen updated DERBY-4815:

    Attachment: d4815.diff

Here's a patch that changes the call from contains(key) to containsKey(key) so that the code
works as intended. I couldn't think of a good regression case for this bug, since we don't
currently have any modules whose different implementations have user-visible differences.

I have verified, though, that if I boot a debug version of Derby when I have multiple versions
of derby.jar in the classpath, I now get messages like these printed to derby.log:

Tue Oct 26 11:28:50 CEST 2010 Thread[main,5,main] Ignored duplicate property derby.module.dataDictionary
in jar:file:/code/derby/trunk0/jars/sane/derby.jar!/org/apache/derby/modules.properties
Tue Oct 26 11:28:50 CEST 2010 Thread[main,5,main] Ignored duplicate property derby.module.lockManagerJ1
in jar:file:/code/derby/trunk0/jars/sane/derby.jar!/org/apache/derby/modules.properties

Without the fix, instead of ignoring the duplicate properties, it would have silently used
the property values from the last derby.jar in the classpath, whereas the classes would have
been loaded from the first derby.jar in the classpath.

All the regression tests ran cleanly with the patch.

> Override mechanism for modules.properties works backwards
> ---------------------------------------------------------
>                 Key: DERBY-4815
>                 URL: https://issues.apache.org/jira/browse/DERBY-4815
>             Project: Derby
>          Issue Type: Bug
>          Components: Services
>    Affects Versions:
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: d4815.diff
> It is possible to override the properties in org/apache/derby/modules.properties by putting
your own version of it somewhere on the classpath. BaseMonitor.getDefaultModuleProperties()
apparently intends to use values from the first modules.properties file that mentions a property:
>                             String key = (String) newKeys.nextElement();
>                             if( moduleList.contains( key))
>                                 // RESOLVE how do we localize messages before we have
finished initialization?
>                                 report( "Ignored duplicate property " + key + " in "
+ modulesPropertiesURL.toString());
>                             else
>                                 moduleList.setProperty( key, otherList.getProperty( key));
> However, moduleList.contains(key) doesn't look for a key in moduleList, it looks for
a property value. This code should have used containsKey() instead.
> Beacuse of this, the last modules.properties on the classpath will take precedence over
the ones earlier on the classpath. So if you for example have two different versions of derby.jar
in the classpath, the engine will use the classes from the first jar and modules.properties
from the last jar.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message