Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Invalid
-
2.2.9
-
None
-
None
-
JDK 7, Websphere Liberty Profile JEE7 - 8.5.5.8
Description
We have a phaseListener that is setup against InvokeApplication phase - so when there is a exception in beforePhase, we set the renderResponse on facesContext, thinking that it will skip further processing and will not broadcast the events on InvokeApplication, but it does.
Class: LifecycleImpl - line # 191 onwards –
if (shouldRenderResponse(context, currentPhaseId, true)) { skipFurtherProcessing = true; } if (executor.execute(context)) { return true; }
Now the above code clearly doesn't skip the executor.execute(context) even when renderResponse was executed.
But Mojarra 2.2.11 - behaves differently - it will skip if renderResponse is called in beforePhase.
com.sun.faces.lifecycle.Phase - line # 99 onwards:
handleBeforePhase(context, listeners, event);
if (!shouldSkip(context)) {
execute(context);
}
"shouldSkip" method impl in Phase.java
private boolean shouldSkip(FacesContext context) { if (context.getResponseComplete()) { return (true); } else if (context.getRenderResponse() && !PhaseId.RENDER_RESPONSE.equals(this.getId())) { return (true); } else { return (false); } }
Now is Mojarra wrong or Myfaces implementation wrong? In cases like this what should be the mechanism to skip the events if render response is set on the before phase.