Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-7164

ConfigurationSource#getProperty(propertyName, defaultValue) throws NullPointerException when defaultValue is null

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3-milestone-1
    • Fix Version/s: 3.5-milestone-1
    • Component/s: Configuration
    • Labels:
      None
    • Tests:
      Unit
    • Difficulty:
      Easy
    • Similar issues:

      Description

      The reason is that CommonsConfigurationSource calls devaultValue.getClass() which fails when defaultValue is null. Stacktrace:

      Caused by: java.lang.NullPointerException
        at org.xwiki.configuration.internal.CommonsConfigurationSource.getProperty(CommonsConfigurationSource.java:60)
        at org.xwiki.configuration.internal.CompositeConfigurationSource.getProperty(CompositeConfigurationSource.java:117)
      

      The javadoc of ConfigurationSource#getProperty(propertyName, defaultValue) doesn't specify that the defaultValue must not be null. We should either fix the javadoc or the implementation.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                tmortagne Thomas Mortagne
                Reporter:
                mflorea Marius Dumitru Florea
              • Votes:
                1 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Date of First Response: