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

Converter issue when using ConfigurationSource#getProperty with Arrays.asList

    XMLWordPrintable

Details

    • Bug
    • Resolution: Solved By
    • Major
    • None
    • 11.10.2
    • Configuration
    • Unknown
    • N/A
    • N/A

    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

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

              Dates

                Created:
                Updated:
                Resolved: