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

Component.getDefaultModelObject() wraps in RuntimeException instead of WicketRuntimeException



    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 7.9.0
    • Fix Version/s: 7.10.0, 8.0.0-M9
    • Component/s: wicket
    • Labels:


      If a model throws an exception when wicket tries to get the model value during rendering using Component.getDefaultModelObject() the original exception will be wrapped in a vanilla RuntimeException. This will then be wrapped again in a WicketRuntimeException. Perhaps there is a reason for this behaviour that I'm not aware of, or perhaps it's just accidental? I would expect the getDefaultModelObject() to wrap directly in a WicketRuntimeException, which will propagate the wicket stack properly without further wrapping.

      My use case is a SessionTimeoutException (originating from a timed out session to a third system) that depending on which path wicket has travelled when the exception is thrown, it is sometimes wrapped directly in a WicketRuntimeException and sometimes wrapped in a RuntimeException wrapped in a WicketRuntimeException. This can be handled by the top level exception handler of course, but requires more complexity and may offer a few runtime WTFs...

      Changing Component.getDefaultModelObject() to throw a WicketRuntimeException should be fairly safe since it is a RuntimeException and it will avoid the redundant wrapping.

      Unit test quickstart attached.

      Last: Thank you for awesomeness!


        1. componentexception.zip
          6 kB
          Per Huss



            • Assignee:
              mgrigorov Martin Tzvetanov Grigorov
              perhuss Per Huss
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: