Uploaded image for project: 'XWork'
  1. XWork
  2. XW-135

StackOverflow

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta2
    • 1.0
    • Type Conversion
    • None

    Description

      > With a CheckboxList returning an array of strings, if this
      > array has a length of 2 elements or more and the target class
      > is not resolved in XWorkBasicConverter, a StackOverflow error
      > is thrown. As a target class, you can take a TreeSet for instance.
      >
      > The involved code from XWorkBasicConverter, you can see where
      > is the error :
      >
      > if (result == null) {
      > if (value instanceof String[]) {
      > String[] array = (String[]) value;
      >
      > if ((array != null) && (array.length == 1))

      { > value = array[0]; > }

      >
      > // let's try to convert the first element only
      > result = this.convertValue(context, o,
      > member, s, value, toType);
      > } else

      { > result = super.convertValue(context, value, toType); > }

      > }
      >
      > I'm also wondering if resolving the target class with the
      > following equality
      > :
      > } else if (toType == Set.class) {
      > result = doConvertToSet(context, value);
      > is not a little bit optimist,
      > Set.class.isAssignableFrom(toType) would be maybe more relax
      > to deal with inherited class.
      >
      > Another remark, what do you think of dealing the arrays in a
      > generic way ... and using the type converter for the value itself :
      >
      > String[] -> Date[] would build a Date array by applying for
      > each value the right converter (String -> Date)
      >
      > Hope it can help.
      > I really enjoy WebWork2, above all because I'm a former struts user.
      >
      > Richard HALLIER
      > Chef de projet
      > richard.hallier@uniclick.org
      > 01.40.12.41.52
      > www.uniclick.org
      > UNICLICK

      Attachments

        Issue Links

          Activity

            People

              jcarreira Jason Carreira
              dharma Richard HALLIER
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: