[ 
https://issues.apache.org/jira/browse/WICKET-2370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12733993#action_12733993
 ] 

Antony Stubbs commented on WICKET-2370:
---------------------------------------

Thanks for the comment Igor, and indeed that's what I have done. 
Of course, I was simply trying to report a possible oversight/problem that 
would affect everyone, not simply a request to have LDM changed to do what I 
want it to do :) But Johan's explanation seems plausible - so I will have to 
create a new implementation that takes care of detach()ing when an exception is 
thrown during load, or something. 

> LoadableDetachableModel sets attached true even when exception occurs during 
> load()
> -----------------------------------------------------------------------------------
>
>                 Key: WICKET-2370
>                 URL: https://issues.apache.org/jira/browse/WICKET-2370
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC7
>            Reporter: Antony Stubbs
>            Assignee: Igor Vaynberg
>
> LoadableDetachableModel sets attached true even when exception occurs during 
> load(). We rely on exceptions being thrown / caught for our caching system, 
> which in this case sits behind our LDM. Problem occurs on 2nd load attempt 
> (where cache would now be populated), LDM returns null because the attached 
> flag is still true.
> <code>
>       public T getObject()
>       {
>               if (!attached)
>               {
>                       attached = true;
>                       transientModelObject = load();
> </code>
> Locally, I will solve this for us by overriding getObject in a custom LDM 
> which will either reorder the calls i.e.
>                       transientModelObject = load();
>                       attached = true;
> or, catch the caching exception and set attached to false.
> I admit this is debatable behaviour though. Thoughts?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to