Reply To: NPE in RewritePhaseListener.handlePhaseOperation

Splash Forums Rewrite Users NPE in RewritePhaseListener.handlePhaseOperation Reply To: NPE in RewritePhaseListener.handlePhaseOperation

#25426

Hmmm. That’s really weird. That shouldn’t happen. Looks like the exception is thrown from this statement:

List<RewriteResultHandler> resultHandlers = ((HttpRewriteLifecycleContext) ((HttpServletRewrite) rewriteEvent)
         .getRequest().getAttribute(RewriteLifecycleContext.LIFECYCLE_CONTEXT_KEY))
         .getResultHandlers();

My guess is that request.getAttribute(RewriteLifecycleContext.LIFECYCLE_CONTEXT_KEY) returns null, but actually I don’t see a reason why this is happening. This attribute is set by the filter and I see no reason why it could be absent.

Any chance that you could try to debug this in your IDE. It would be interesting to see what is null here. This should be possible with an exception breakpoint.

Or could you perhaps provide a minimal sample app that reproduces this?