Uploaded image for project: 'Causeway'
  1. Causeway
  2. CAUSEWAY-3013

[Wicket Viewer] ComponentHintKey can cause NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0-M7
    • 2.0.0-M8
    • Viewer Wicket
    • None

    Description

      There is two method to access key value in ComponentHintKey  according to the getKey() method: accessing the component directly if exists, or the componentProvider.  But componentProvider is transient: after the serialization/deserialization cycle it can not be accessed, causing NullPointerException in getKey(). (Wicket viewer caches the page, so serialization is a must)

      Solution: gain access to the component directly on serialization:

       

      private void writeObject(ObjectOutputStream oos)
              throws IOException {
          if (componentProvider != null && component == null) {
              try {
                  component = componentProvider.get();
              } catch (Exception ignored) {
      // Maybe some log is necessary or throw the error
              }
          }
          oos.defaultWriteObject();
      } 

       

      Attachments

        Issue Links

          Activity

            People

              hobrom Andi Huber
              gyorfimi Miklós Győrfi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: