Skip to content

Commit b644409

Browse files
committed
Merge #5528 from 4.1 into 5.0
2 parents b7bc22a + 30f2242 commit b644409

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

impl/src/main/java/com/sun/faces/lifecycle/RestoreViewPhase.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@
4242
import java.util.Set;
4343
import java.util.logging.Logger;
4444

45-
import com.sun.faces.util.FacesLogger;
46-
import com.sun.faces.util.MessageUtils;
47-
import com.sun.faces.util.Util;
48-
4945
import jakarta.el.MethodExpression;
5046
import jakarta.faces.FacesException;
5147
import jakarta.faces.application.ProtectedViewException;
@@ -70,6 +66,10 @@
7066
import jakarta.faces.view.ViewDeclarationLanguage;
7167
import jakarta.faces.view.ViewMetadata;
7268

69+
import com.sun.faces.util.FacesLogger;
70+
import com.sun.faces.util.MessageUtils;
71+
import com.sun.faces.util.Util;
72+
7373
/**
7474
* <B>Lifetime And Scope</B>
7575
* <P>
@@ -78,7 +78,9 @@
7878
*/
7979
public class RestoreViewPhase extends Phase {
8080

81-
private static final String WEBAPP_ERROR_PAGE_MARKER = "jakarta.servlet.error.message";
81+
private static final String WEBAPP_ERROR_MESSAGE_MARKER = "jakarta.servlet.error.message"; // RequestDispatcher.ERROR_MESSAGE
82+
private static final String WEBAPP_ERROR_EXCEPTION_MARKER = "jakarta.servlet.error.exception"; // RequestDispatcher.ERROR_EXCEPTION
83+
8284
private static final Logger LOGGER = FacesLogger.LIFECYCLE.getLogger();
8385

8486
private static final Set<VisitHint> SKIP_ITERATION_HINT = EnumSet.of(SKIP_ITERATION);
@@ -430,11 +432,12 @@ private void notifyAfter(FacesContext context, Lifecycle lifecycle) {
430432
* Use this method to determine if the current request is an error page to avoid the above condition.
431433
*
432434
* @param context the FacesContext for the current request
433-
* @return <code>true</code> if <code>WEBAPP_ERROR_PAGE_MARKER</code> is found in the request, otherwise return
434-
* <code>false</code>
435+
* @return <code>true</code> if <code>WEBAPP_ERROR_MESSAGE_MARKER</code> or <code>WEBAPP_ERROR_EXCEPTION_MARKER</code>
436+
* is found in the request, otherwise return <code>false</code>
435437
*/
436438
private static boolean isErrorPage(FacesContext context) {
437-
return context.getExternalContext().getRequestMap().get(WEBAPP_ERROR_PAGE_MARKER) != null;
439+
Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
440+
return requestMap.get(WEBAPP_ERROR_MESSAGE_MARKER) != null || requestMap.get(WEBAPP_ERROR_EXCEPTION_MARKER) != null;
438441
}
439442

440443
}

0 commit comments

Comments
 (0)