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

Converter issue when using ConfigurationSource#getProperty with Arrays.asList

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Solved By
    • Affects Version/s: 11.10.2
    • Fix Version/s: None
    • Component/s: Configuration
    • Labels:
    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      Description

      Using an API such as:

      return this.configurationSource.getProperty("myProperty", Arrays.asList("/", "\\"));
      

      where "myProperty" is a Static List will lead to the following stack trace, if values are present:

      Caused by: org.xwiki.properties.converter.ConversionException: Failed to find a Converter to convert from [com.xpn.xwiki.objects.ListProperty$NotifyList] to [java.util.Arrays$ArrayList]
      	at org.xwiki.properties.internal.converter.ConvertUtilsConverter.convert(ConvertUtilsConverter.java:82)
      	at org.xwiki.properties.internal.converter.ConvertUtilsConverter.convert(ConvertUtilsConverter.java:101)
      	at org.xwiki.properties.internal.DefaultConverterManager.convert(DefaultConverterManager.java:114)
      	at org.xwiki.configuration.internal.AbstractDocumentConfigurationSource.getPropertyValue(AbstractDocumentConfigurationSource.java:329)
      	at org.xwiki.configuration.internal.AbstractDocumentConfigurationSource.getProperty(AbstractDocumentConfigurationSource.java:277)
      

      The core issue is that if there is a converter for java.util.ArrayList, there is no converter for java.util.Arrays#ArrayList which is used when calling Arrays.asList(...).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                surli Simon Urli
                Reporter:
                surli Simon Urli
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: