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

NullPointerException thrown from BaseWicketTester isComponent

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 1.4.1
    • 1.4.4, 1.5-M1
    • wicket
    • None
    • N/A

    Description

      If a component is not visible, then "getComponentFromLastRenderedPage" will return null (as opposed to failing if it is not present). In the check below, it seems like "Result.fail" is missing a "return" preceding it. Otherwise, the "component.getClass()" immediately following will generate an NullPointerException.

      public <C extends Component> Result isComponent(String path, Class<C> expectedComponentClass)
      {
      Component component = getComponentFromLastRenderedPage(path);
      if (component == null)

      { Result.fail("Component not found: " + path); // <-- Should return here. }

      return isTrue("component '" + Classes.simpleName(component.getClass()) + "' is not type:" + // <-- NPE thrown here
      Classes.simpleName(expectedComponentClass),
      expectedComponentClass.isAssignableFrom(component.getClass()));
      }

      Attachments

        Activity

          People

            ivaynberg Igor Vaynberg
            breuere Ed Breuer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: