Portals Bridges
  1. Portals Bridges
  2. PB-72

ClassCastException in PortletApplicationModelImpl since Spring Framework 2.0.5

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.3
    • Fix Version/s: 1.0.4
    • Component/s: frameworks
    • Labels:
      None

      Description

      The following lines in o.a.p.b.frameworks.spring.PortletApplicationModelImpl has throws ClassCastException:

      PropertyValue value = bd.getPropertyValues().getPropertyValue("lookupKey");
      if (value != null)
      {
      lookup = (String)value.getValue(); // ClassCastException here: getValue does not return String object any more.
      // ...
      }

      I found this problem when I tried to integrate a customized j2-admin's PortalSiteDetails portlet with Jetspeed-2.1.2.
      The portlet is customized from the old j2-admin::SiteDetailsPortlet, which is out-of-date in Jetspeed-2.1.2.
      Anyway, this problem can occur when a portlet utilizes framework bridge.

        Activity

        Woonsan Ko created issue -
        Hide
        Woonsan Ko added a comment -

        This problem occurs after Spring Framework was upgraded to 2.0.5.
        Since Spring Framework 2.0.3, the value of PropertyValue from BeanDefinition is changed from value object to TypedStringValue object. ( See http://springframework.cvs.sourceforge.net/springframework/spring/src/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java?r1=1.27&r2=1.28 )

        Also, according to javadoc of SpringFramework for org.springframework.beans.PropertyValue, it says:
        "Note that type conversion will not have occurred here. It is the responsibility of the BeanWrapper implementation to perform type conversion."

        The default implementation of BeanWrapper of Spring Framework uses o.sf.factory.config.BeanDefinitionVisitor, which checks if the attribute value is instance of TypedStringValue or instance of String.
        Therefore, PortletApplicationModelImpl should use this technique also.

        I'm attaching a patch for this after testing.

        Show
        Woonsan Ko added a comment - This problem occurs after Spring Framework was upgraded to 2.0.5. Since Spring Framework 2.0.3, the value of PropertyValue from BeanDefinition is changed from value object to TypedStringValue object. ( See http://springframework.cvs.sourceforge.net/springframework/spring/src/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java?r1=1.27&r2=1.28 ) Also, according to javadoc of SpringFramework for org.springframework.beans.PropertyValue, it says: "Note that type conversion will not have occurred here. It is the responsibility of the BeanWrapper implementation to perform type conversion." The default implementation of BeanWrapper of Spring Framework uses o.sf.factory.config.BeanDefinitionVisitor, which checks if the attribute value is instance of TypedStringValue or instance of String. Therefore, PortletApplicationModelImpl should use this technique also. I'm attaching a patch for this after testing.
        Woonsan Ko made changes -
        Field Original Value New Value
        Attachment pamodel-diff.txt [ 12362963 ]
        Woonsan Ko made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Woonsan Ko
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development