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

LoadableDetachableModel sets attached true even when exception occurs during load()

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.4-RC7
    • Fix Version/s: None
    • Component/s: wicket
    • Labels:
      None

      Description

      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?

        Attachments

          Activity

            People

            • Assignee:
              ivaynberg Igor Vaynberg
              Reporter:
              astubbs Antony Stubbs
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: