Note that the above code is doomed to fail. The mapped exception will be processed by the filter again and that would throw the NPE again... The second NPE is not mapped (as per spec sect. 4.5) again, but propagated to the hosting container.
I have added a Jersey E2E test that verifies that if an exception is only thrown once in the response filter, it get's mapped and the mapped response is propagated back to the client (after being processed by the filter chain again).