I ran into a problem where wicket(1.2.x) actually swallowed my exception
before reporting it to me and showed another exception. Take this code for
example :

add(new MyComponent("id",new LoadableDetachableModel() {
           public void load() {
                     // do something that throws some nasty exception
                     // but expect to return an object of type
MyModelObject
           }

} ) {
         public boolean isVisible() {

((MyModelObject)getModel().getObject(null)).isComponentVisible();
         }

};

The exception thrown in the load method will not be shown, because
1 - the LoadableDetachableModel first sets attached=true then loads the
object
2 - An exception is thrown, so in Markupcontainer it will be catched
3 - the exception is appended with the MarkupContainer.toString() String ,
which will call many methods on the component, including isVisible()
4 - the isVisible method uses the model again which it thinks its attached ,
but the getObject will return null , so a new nullpointerexception will be
thrown, and the previous exception is lost

Actually the Component.toString() method is somehow heavy, and normally any
exception thrown in the middle of it would cause bad behavior in wicket. Is
there a chance to improve this somehow, or make exception handling aware of
problems that might arise when calling the toString method and let it handle
them ?
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to