Sounds like there is some other exception thrown that is caught somewhere upwards your callstack. You could try to catch Exception and in your catch block log the actual Exception class to see what you actually caught.

On Sun, 21 Aug 2011, Florian B. wrote:

Hi

I'm trying to add exception handling to one of my pages but I'm a little bit
stuck.

I've got a page that loads an entity using a DAO (Hibernate, Spring). In
case of an error due to optimistic locking I want to reload the page with
the updated entity and display a message on a feedback panel.

The onSubmit() method of my button looks like that:

@Override
public void onSubmit() {
   // save store to DB
   try {
           storeDao.saveOrUpdate(store);
           setResponsePage(StoreTablePage.class);
   } catch (StaleObjectStateException ex) {
            store = storeDao.retrieve(store.getId());
            error(new
StringResourceModel("form.error.optimisticLockingException", this,
null).toString());
   }
}

What is weird is that when I write "catch (StaleObjectStateException ex)"
then the exception is somehow intercepted and the catch section is never
reached, instead a stack trace of the exception is shown. When I change it
to "catch (Exception ex)" then it works as expected. At the moment I'm
running the Wicket application in development mode.

Am I missing some important concept about exceptions in Wicket?

Bye,
Florian


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/StaleObjectStateException-got-intercepted-tp3758154p3758154.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to