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

NullPointerException when using CheckGroup and a Validator

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.2.5
    • 1.2.6
    • wicket
    • None
    • tomcat 5.5, java 1.5

    Description

      Problem occurs when using a listView with a checkgroup in the same form with a input Validator. When the Validator detects invalid input and no items from the CheckGroup were selected, Wicket throws a NullPointer Exception on the first ListView item.

      Specifically, in the Check class, the group.getInputAsArray() returns null and causes the NPE:
      if (group.hasRawInput()) {
      final String[] input = group.getInputAsArray();
      for (int i = 0; i < input.length; i++)
      { ....

      The problem is solved by overriding the isNullable() method for CheckGroup to return false.
      @Override
      public boolean isInputNullable()

      { return false; }

      Apologies for describing symptoms rather than mechanism. More experienced programmers in the office think the model for CheckGroup is not attached or detached properly when used in conjunction with the (Pattern)Validator.

      Attachments

        Activity

          People

            ivaynberg Igor Vaynberg
            ivana Ivana Cace
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: