Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2354

PropertyModel does not support index only property ("[0]")

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3.6
    • Fix Version/s: 1.3.7, 1.4-RC7
    • Component/s: wicket
    • Labels:
      None
    • Environment:
      Windows XP, Eclipse 1.3.6, Java 1.6.0.13, Wicket 1.3.6

      Description

      When using a PropertyModel with a list as target and an index ("[0]") as property the PropertyModel cannot retreive the object from the list. When getObject() is called a IndexOutOfBoundsException is thrown.

      Example:
      List addresses = new List();
      new PropertyModel(addresses, "[0]");
      model.getObject();

      Exception:
      java.lang.StringIndexOutOfBoundsException: String index out of range: 0
      at java.lang.String.charAt(String.java:687)
      at org.apache.wicket.util.lang.PropertyResolver.findGetter(PropertyResolver.java:509)
      at org.apache.wicket.util.lang.PropertyResolver.getGetAndSetter(PropertyResolver.java:338)
      at org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:224)
      at org.apache.wicket.util.lang.PropertyResolver.getValue(PropertyResolver.java:91)
      at org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPropertyModel.java:113)

      I have attached a QuickStart (with 2 test; 1 with the current PropertyResolver and 1 with the patched PropertyResolver) and a patch file.

        Attachments

        1. wicket-bug2354.zip
          50 kB
          Hielke Hoeve
        2. wicket-bug2354.patch
          0.4 kB
          Hielke Hoeve

          Activity

            People

            • Assignee:
              jcompagner Johan Compagner
              Reporter:
              hielkehoeve Hielke Hoeve
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 10m
                10m
                Remaining:
                Remaining Estimate - 10m
                10m
                Logged:
                Time Spent - Not Specified
                Not Specified