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

NPE in PackageResourceReference#getResource() when there is no request

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 7.1.0
    • 7.2.0, 8.0.0-M1
    • None
    • None

    Description

      This is my first filed issue, so please help me if I'm not filing this correctly.

      This issue came across when migrating Apache 6.19.0 to 7.1.0. In our original implementation we added the pie.htc to the applications shared resources in MyWebApplication#init()

      getSharedResources().add("/pie.htc", new PackageResourceReference(MyWebApplication.class, "pie.htc").getResource());
      

      The resource file is next to the MyWebApplication's file and it worked in 6.19.0. Now, in 7.1.0, the method PackageResourceReference#getResource() has been extended and now takes into account the variation, style and locale of the request url.
      So, obtaining the resource now depends on the request, which is not available when initializing the application, which results in a NullPointerException in the following line:

      org.apache.wicket.request.resource.PackageResourceReference.getResource(PackageResourceReference.java:115)
      
      final Url url = RequestCycle.get().getRequest().getUrl();
      

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            dvendt David Vendt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: