Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-6807

ConversionService fails with CustomEditorConfigurer

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0 GA
    • Fix Version/s: 3.0.1
    • Component/s: None
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      ConversionService fails with CustomEditorConfigurer. While it is not recommended to mix the two in the same context it is unavoidable if users want to use Spring Batch and a ConversionService (because Batch is 2.5.6 compatible and installs its own converter).

      So if you install a CustomEditorConfigurer like this

      	<bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
      		<property name="customEditors">
      			<map key-type="java.lang.String" value-type="java.lang.Class">
      				<entry key="org.springframework.batch.item.file.transform.Range[]" value="org.springframework.batch.item.file.transform.RangeArrayPropertyEditor"/>
      			</map>
      		</property>
      	</bean>

      and then a ConversionService using the factory bean, you get an exception on startup saying that the ConversionService cannot convert the map in the CustomEditorConfigurer:

      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customEditorConfigurer' defined in file [....xml]: Initialization of bean failed; nested exception is org.springframework.core.convert.ConversionFailedException: Unable to convert value {org.springframework.batch.item.file.transform.Range[]=class org.springframework.batch.item.file.transform.RangeArrayPropertyEditor} from type 'java.util.LinkedHashMap' to type 'java.util.Map'; nested exception is java.lang.IllegalArgumentException: Left-hand side type must not be null
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
      	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
      	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1008)
      	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:604)
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:398)
      	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
      	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
      	at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280)
      	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304)
      	... 24 more
      Caused by: org.springframework.core.convert.ConversionFailedException: Unable to convert value {org.springframework.batch.item.file.transform.Range[]=class org.springframework.batch.item.file.transform.RangeArrayPropertyEditor} from type 'java.util.LinkedHashMap' to type 'java.util.Map'; nested exception is java.lang.IllegalArgumentException: Left-hand side type must not be null
      	at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:40)
      	at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:135)
      	at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:199)
      	at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:154)
      	at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:452)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1351)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1310)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1067)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
      	... 36 more
      Caused by: java.lang.IllegalArgumentException: Left-hand side type must not be null
      	at org.springframework.util.Assert.notNull(Assert.java:112)
      	at org.springframework.util.ClassUtils.isAssignable(ClassUtils.java:806)
      	at org.springframework.core.convert.TypeDescriptor.isTypeAssignableTo(TypeDescriptor.java:459)
      	at org.springframework.core.convert.TypeDescriptor.isAssignableTo(TypeDescriptor.java:373)
      	at org.springframework.core.convert.support.MapToMapConverter.convert(MapToMapConverter.java:81)
      	at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:37)
      	... 44 more

        Issue Links

          Activity

          No work has yet been logged on this issue.

            People

            • Assignee:
              juergen.hoeller Juergen Hoeller
              Reporter:
              david_syer Dave Syer
              Last updater:
              Trevor Marshall
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                7 years, 37 weeks, 4 days ago