Uploaded image for project: 'Struts 1'
  1. Struts 1
  2. STR-3081

Uploading a File using LazyDynaBean causes ClassCastException

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.9
    • Fix Version/s: 1.3.10, 1.4.0
    • Component/s: Core
    • Labels:
      None

      Description

      The changes to RequestUtils associated with STR-487 cause my application to throw "java.lang.ClassCastException: java.util.ArrayList"

      http://svn.apache.org/viewvc?view=rev&revision=524895

      I use LazyDynaBean which returns Object.class as the property type of any property which is not defined (since null would indicate no property and one of the "lazy" features is to add properties automatically on "set"). Theres a bug in the changes for r524895 which is using the Class's isAssignableFrom() method the wrong way round:

      propertyType.isAssignableFrom(List.class)

      The above will return "true" when propertyType is "Object.class" - and so a List is created which my application is not expecting (it expects a FormFile). I believe the above will also fail if the property type is an ArrayList which is also not desirable - correct code should be:

      List.class.isAssignableFrom(propertyType)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                niallp Niall Pemberton
                Reporter:
                niallp Niall Pemberton
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: