Wicket
  1. Wicket
  2. WICKET-3673

A little heuristic for "Unable to find component" exception

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.17
    • Fix Version/s: 1.5-RC5
    • Component/s: wicket
    • Labels:
      None

      Description

      Sometimes it's easy to get lost in the structure of a page / component.
      This leads to a situation when the component is correctly created in HTML and code, but at different level, like

      form.add(new Label("foo", ...))
             add(new Label("bar", ...))
      

      instead of

      form.add(new Label("foo", ...))
            .add(new Label("bar", ...))
      

      I suggest that the component map could be searched for components with the ID which is not found where expected, and if such ID would be found at different level, it would advice the user to check whether the structure is ok instead of simply stating "not found".

      Since this is the most common cause of that exception (from my experience),
      I think this could save users from loosing time on checking typos etc, when they are out of caffeine and start doing mistakes at the end of the day

      Thanks for considering.

        Issue Links

          Activity

          Hide
          Juergen Donnerstag added a comment -

          A little heuristic has been added to 1.5

          Please see WICKET-3335 for a more comprehensive approach to avoid it alltogether.

          Show
          Juergen Donnerstag added a comment - A little heuristic has been added to 1.5 Please see WICKET-3335 for a more comprehensive approach to avoid it alltogether.
          Hide
          Juergen Donnerstag added a comment -

          Applied a small patch improving the error message

          Show
          Juergen Donnerstag added a comment - Applied a small patch improving the error message
          Hide
          Igor Vaynberg added a comment -

          Martin is reffering to WICKET-3335 which is similar. where as this request asks for better error handling, the feature in WICKET-3335 allows users a more flexible way of constructing the hierarchy eliminated errors like above almost entirely.

          Show
          Igor Vaynberg added a comment - Martin is reffering to WICKET-3335 which is similar. where as this request asks for better error handling, the feature in WICKET-3335 allows users a more flexible way of constructing the hierarchy eliminated errors like above almost entirely.
          Hide
          Martin Grigorov added a comment -

          There is some work on this at https://github.com/ivaynberg/wicket/tree/component-queuing.
          AFAIR there is no other ticket, but I may be wrong.

          Show
          Martin Grigorov added a comment - There is some work on this at https://github.com/ivaynberg/wicket/tree/component-queuing . AFAIR there is no other ticket, but I may be wrong.

            People

            • Assignee:
              Juergen Donnerstag
              Reporter:
              Ondra Žižka
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development