Uploaded image for project: 'XBean'
  1. XBean
  2. XBEAN-93

Don't validate type on PropertyEditorSupport.setValue()/toString() calls

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1, 3.2
    • 3.2
    • reflect
    • None

    Description

      I ran into the following error on G 2.0.1 with Spring versions 2.0.5-2.0.7-SNAPSHOT. PropertyEditor.setValue() is being called with an object whose type does not match the defined type.

      15:54:12,596 ERROR [ContextLoader] Context initialization failed
      org.springframework.beans.factory.access.BootstrapException: Unable to initialize group definition. Group resource name [classpath*:beanRefContext.xml], factory key [ear.context]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ear.context' defined in URL [jar:file:/Users/kevan/Desktop/geronimo-tomcat6-jee5-2.0.1/repository/org/spring/example/MultipleContexts/1.0/MultipleContexts-1.0.ear/lib/SampleJava.jar!/beanRefContext.xml]: Instantiation of bean failed; nested exception is org.apache.xbean.propertyeditor.PropertyEditorException: Value is not an instance of String
      Caused by:
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ear.context' defined in URL [jar:file:/Users/kevan/Desktop/geronimo-tomcat6-jee5-2.0.1/repository/org/spring/example/MultipleContexts/1.0/MultipleContexts-1.0.ear/lib/SampleJava.jar!/beanRefContext.xml]: Instantiation of bean failed; nested exception is org.apache.xbean.propertyeditor.PropertyEditorException: Value is not an instance of String
      Caused by:
      org.apache.xbean.propertyeditor.PropertyEditorException: Value is not an instance of String
      at org.apache.xbean.propertyeditor.AbstractConverter.setValue(AbstractConverter.java:67)
      at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:276)
      at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:192)
      <snip>

      Spring has been updated in latest builds to ignore this problem (see http://opensource.atlassian.com/projects/spring/browse/SPR-3799). There's some question about what the proper behavior is in this case... I didn't find any spec-level guidance... http://weblogs.java.net/blog/ljnelson/archive/2007/08/objects_and_str.html (search for 'dilemma') recommends logging the condition and ignoring the type mismatch.

      I'm going to remove the type checking.

      Attachments

        Activity

          People

            kevan Kevan Lee Miller
            kevan Kevan Lee Miller
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: