You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/04/23 21:23:03 UTC

[tomcat] 01/05: pageContext is never null

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 9c2fd70f99f031489425d96359eac7580cef2803
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Apr 23 20:17:40 2020 +0100

    pageContext is never null
---
 test/webapp/jsp/pageContext1.jsp | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/test/webapp/jsp/pageContext1.jsp b/test/webapp/jsp/pageContext1.jsp
index d4bb322..1f44f97 100644
--- a/test/webapp/jsp/pageContext1.jsp
+++ b/test/webapp/jsp/pageContext1.jsp
@@ -17,23 +17,19 @@
 <%@ page import="java.io.IOException" contentType="text/plain"%>
 <%
     boolean flush = Boolean.parseBoolean(request.getParameter("flush"));
-    if (pageContext != null) {
-        try {
-            if (flush) {
-                out.println("Flush");
-                pageContext.include("/jsp/pageContext2.jsp", true);
-            } else {
-                pageContext.include("/jsp/pageContext2.jsp");
-            }
-        } catch (IOException e) {
-            out.println("OK");
-            return;
-        } catch (Throwable t) {
-            out.println("FAILED. Expected IOException, received: " + t.getClass().getName());
-            return;
+    try {
+        if (flush) {
+            out.println("Flush");
+            pageContext.include("/jsp/pageContext2.jsp", true);
+        } else {
+            pageContext.include("/jsp/pageContext2.jsp");
         }
-        out.println("FAILED. Expected IOException.");
-    } else {
-        out.println("FAILED. Expected IOException.");
+    } catch (IOException e) {
+        out.println("OK");
+        return;
+    } catch (Throwable t) {
+        out.println("FAILED. Expected IOException, received: " + t.getClass().getName());
+        return;
     }
+    out.println("FAILED. Expected IOException.");
 %>
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org