commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Heger (JIRA)" <>
Subject [jira] Commented: (CONFIGURATION-342) DatabaseConfiguration.copy() loses list/array values
Date Wed, 22 Oct 2008 20:01:44 GMT


Oliver Heger commented on CONFIGURATION-342:

It seems to me that the support for properties with multiple values in DatabaseConfiguration
is broken. I don't know whether it ever worked, but I doubt it. I guess the problem is that
when inserting the 2nd value of the property the database throws an exception similar to the
following one:

{{java.sql.SQLException: Violation of unique constraint $$: duplicate value(s) for column(s)
$$: SYS_PK_47 in statement [INSERT INTO configuration (key, value) VALUES (?, ?)]}}

(This is at least what I get in the unit tests.) This exception is not re-thrown by the configuration,
but an error event is fired. If you register an error listener, you will probably see such
an event.

I am not sure how to handle this problem. IMO the only solution would be to require an additional
database column with a unique ID, so that no unique constraint can be violated. However, then
we have to deal with stuff like ID generation, which can be highly specific depending on the
use case.

> DatabaseConfiguration.copy() loses list/array values
> ----------------------------------------------------
>                 Key: CONFIGURATION-342
>                 URL:
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Type conversion
>    Affects Versions: 1.5
>            Reporter: Scott Wells
> I've found a bug where adding a list property to a BaseConfiguration, then copying that
full BaseConfiguration to a DatabaseConfiguration, the list is lost and only the first element
is copied to the destination DatabaseConfiguration.  For example:
> BaseConfiguration bc = new BaseConfiguration();
> bc.addProperty("myList", Arrays.asList("1", "2", "3", "4");
> DatabaseConfiguration dc = new DatabaseConfiguration(...);
> dc.copy(bc);
> List list = dc.getList("myList");
> // At this point, you'll get a single element list containing only "1"

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

View raw message