Commons Configuration
  1. Commons Configuration
  2. CONFIGURATION-255

DatabaseConfiguration doesn't support list delimiters in property values

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3
    • Fix Version/s: 1.4
    • Component/s: None
    • Labels:
      None
    • Environment:

      Sun Java(TM) System Application Server Platform Edition 9.0, Oracle 9i

      Description

      The getList() and getStringArray() methods always return a one element list/array, when used with DatabaseConfiguration, even if the value of the queried property contains the list delimiter character.

        Activity

        Hide
        Oliver Heger added a comment -

        Updated summary and description to better explain the problem.

        Show
        Oliver Heger added a comment - Updated summary and description to better explain the problem.
        Hide
        Oliver Heger added a comment -

        The problem should be fixed now. I made two changes:

        • getProperty() now checks for list delimiters in the values obtained from the database.
        • addProperty() temporarily disables delimiter parsing, so that only a single INSERT is performed for a string property whose value contains the delimiter character.

        Tests for this behavior have also been added.

        Please double-check. Thanks.

        Show
        Oliver Heger added a comment - The problem should be fixed now. I made two changes: getProperty() now checks for list delimiters in the values obtained from the database. addProperty() temporarily disables delimiter parsing, so that only a single INSERT is performed for a string property whose value contains the delimiter character. Tests for this behavior have also been added. Please double-check. Thanks.
        Hide
        Oliver Heger added a comment -

        Okay, I see the problem now. Will have a look.

        Show
        Oliver Heger added a comment - Okay, I see the problem now. Will have a look.
        Hide
        Thibaut Martin added a comment -

        Hello,

        Here is my example:

        DatabaseConfiguration configuration = new DatabaseConfiguration
        (dataSource, "CONF", "KEY", "VALUE");

        LOG.debug (configuration.isDelimiterParsingDisabled ()); =>
        false
        LOG.debug (configuration.getListDelimiter ()); => ,

        String value = configuration.getString (key);
        LOG.debug (value); =>
        a,b,c

        List<String> list = configuration.getList (key);
        LOG.debug (list.size ()); => 1
        for (String element: list)

        { LOG.debug (element); => a,b,c }

        Thibaut

        Show
        Thibaut Martin added a comment - Hello, Here is my example: DatabaseConfiguration configuration = new DatabaseConfiguration (dataSource, "CONF", "KEY", "VALUE"); LOG.debug (configuration.isDelimiterParsingDisabled ()); => false LOG.debug (configuration.getListDelimiter ()); => , String value = configuration.getString (key); LOG.debug (value); => a,b,c List<String> list = configuration.getList (key); LOG.debug (list.size ()); => 1 for (String element: list) { LOG.debug (element); => a,b,c } Thibaut
        Hide
        Oliver Heger added a comment -

        Do you have a concrete example where the getList() method is failing? There is a unit test case that fetches a list, and this test is obviously working.

        Show
        Oliver Heger added a comment - Do you have a concrete example where the getList() method is failing? There is a unit test case that fetches a list, and this test is obviously working.

          People

          • Assignee:
            Oliver Heger
            Reporter:
            Thibaut Martin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development