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

OptionsTags use toString instead of a Cast: (String)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0 Beta 2
    • 1.0.0
    • Tag Libraries
    • None
    • Operating System: All
      Platform: PC
    • 1825

    Description

      Hi,

      I always change this:

      String value = (String)valuesIterator.next();
      String label = value;
      if (labelsIterator.hasNext())
      label = (String)labelsIterator.next();

      to this:
      String value = valuesIterator.next().toString();
      String label = value;
      if (labelsIterator.hasNext())
      label = labelsIterator.next().toString();

      In the current state i always must have Strings into the collections
      But many times especially form values i have a Integer array
      (if i could use int[] it was even better) as id's
      So calling to string instead of the cast is a much better approace and
      don't bound you to using strings.
      Maybe there should be a extra null check then?

      johan

      Attachments

        Activity

          People

            craigmcc Craig R. McClanahan
            jcompagner Johan Compagner
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: