Uploaded image for project: 'Commons Configuration'
  1. Commons Configuration
  2. CONFIGURATION-78

Inconsistent handling for keys that don't exist

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • 2.x
    • None
    • None
    • 34098

    Description

      The getXXX(String key) methods in AbstractConfiguration are not consistent in
      how they handle non-existing keys:
      getProperty(String key) - returns null
      getString(String key) - throws an exception if isThrowExceptionOnMissing is true
      getShort(String key) - throws an exception
      getStringArray(String key) - returns an empty array (why not null?)

      etc.

      I suggest that all these methods (include getProperty()) will check
      isThrowExceptionOnMissing and if true, throw an exception.

      As it is, it makes it hard to extend this class, and use Configuration in
      general.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ittayd@qlusters.com Ittay Dror
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: