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':
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?