Wicket
  1. Wicket
  2. WICKET-3918

NPE when requesting http://example.com/app/wicket/resource/org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow/res/

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5-RC5.1
    • Fix Version/s: 1.5-RC6
    • Component/s: wicket
    • Labels:
      None

      Description

      When requesting the following URL, the default caching strategy throws a NullPointerException and this is logged. This request is performed by some spider agent of Microsoft (trying to kill Wicket!) with user agent 'Microsoft Office Protocol Discovery':

      Url=http://example.com/app/wicket/resource/org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow/res/

      java.lang.NullPointerException: caching strategy must not return an empty filename
      at org.apache.wicket.request.mapper.BasicResourceReferenceMapper.mapRequest(BasicResourceReferenceMapper.java:102)
      at org.apache.wicket.request.mapper.ParentPathReferenceRewriter.mapRequest(ParentPathReferenceRewriter.java:83)
      at org.apache.wicket.request.mapper.CompoundRequestMapper.mapRequest(CompoundRequestMapper.java:129)
      at org.apache.wicket.request.cycle.RequestCycle.resolveRequestHandler(RequestCycle.java:183)
      at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:208)
      at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:253)
      at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:160)
      at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:216)

      A couple of points:

      • the exception should log which strategy caused the empty filename
      • the exception might want to log the requested URL for the resource
      • perhaps a NullPointerException is not the best exception to throw, but rather something that results in a 404 or a 403
      • maybe not even throwing an exception is the best way to handle this case, instead rely on the container or another mapper to take the lead?

        Activity

        Hide
        Martin Grigorov added a comment -

        +1 for more logging and let the next IRequestMapper to handle the request.

        Show
        Martin Grigorov added a comment - +1 for more logging and let the next IRequestMapper to handle the request.
        Hide
        Martijn Dashorst added a comment -

        Fixed by logging the mismatch at debug level and returning null from the mapRequest method to let another mapper try it

        Show
        Martijn Dashorst added a comment - Fixed by logging the mismatch at debug level and returning null from the mapRequest method to let another mapper try it
        Hide
        Martin Grigorov added a comment -

        There is the same problem in org.apache.wicket.request.mapper.BasicResourceReferenceMapper.mapHandler(IRequestHandler)

        Show
        Martin Grigorov added a comment - There is the same problem in org.apache.wicket.request.mapper.BasicResourceReferenceMapper.mapHandler(IRequestHandler)
        Hide
        Martijn Dashorst added a comment -

        Also fixed.

        Show
        Martijn Dashorst added a comment - Also fixed.

          People

          • Assignee:
            Martijn Dashorst
            Reporter:
            Martijn Dashorst
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development