[Pki-devel] [PATCH] 607 Fixed NPE in ROOT's index.jsp.

Endi Sukma Dewata edewata at redhat.com
Fri Jun 5 00:23:19 UTC 2015


The ROOT's index.jsp has been modified to check each subsystem's
servlet context for null before accessing the value.

https://fedorahosted.org/pki/ticket/1407

-- 
Endi S. Dewata
-------------- next part --------------
From 4a5a4fc1460ef4464cb71b268b5774399aa5a9a6 Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata at redhat.com>
Date: Thu, 4 Jun 2015 19:58:52 -0400
Subject: [PATCH] Fixed NPE in ROOT's index.jsp.

The ROOT's index.jsp has been modified to check each subsystem's
servlet context for null before accessing the value.

https://fedorahosted.org/pki/ticket/1407
---
 base/server/share/webapps/ROOT/index.jsp | 44 ++++++++++++++++++++------------
 1 file changed, 27 insertions(+), 17 deletions(-)

diff --git a/base/server/share/webapps/ROOT/index.jsp b/base/server/share/webapps/ROOT/index.jsp
index 509a2d02ed79fcc3c97c516e587d22bcb5de84a3..648a3470fd9dc49dae96571abe26a9852ce2d0bc 100644
--- a/base/server/share/webapps/ROOT/index.jsp
+++ b/base/server/share/webapps/ROOT/index.jsp
@@ -89,9 +89,10 @@ $(function() {
 
 <%
     ServletContext caContext = getServletContext().getContext("/ca");
-    String caName = caContext.getServletContextName();
-    String caPath = caContext.getContextPath();
-    if (!"".equals(caPath)) {
+    if (caContext != null) {
+        String caName = caContext.getServletContextName();
+        String caPath = caContext.getContextPath();
+        if (!"".equals(caPath)) {
 %>
 <p>
 <font size="+1" face="PrimaSans BT, Verdana, Arial, Helvetica, sans-serif">
@@ -107,7 +108,7 @@ $(function() {
     </td>
 </tr>
 <%
-        if (request.isSecure()) {
+            if (request.isSecure()) {
 %>
 <tr valign="TOP">
     <td>
@@ -122,19 +123,21 @@ $(function() {
     </td>
 </tr>
 <%
-        }
+            }
 %>
 </table>
 
 <br>
 
 <%
+        }
     }
 
     ServletContext kraContext = getServletContext().getContext("/kra");
-    String kraName = kraContext.getServletContextName();
-    String kraPath = kraContext.getContextPath();
-    if (!"".equals(kraPath) && request.isSecure()) {
+    if (kraContext != null) {
+        String kraName = kraContext.getServletContextName();
+        String kraPath = kraContext.getContextPath();
+        if (!"".equals(kraPath) && request.isSecure()) {
 %>
 <p>
 <font size="+1" face="PrimaSans BT, Verdana, Arial, Helvetica, sans-serif">
@@ -160,12 +163,14 @@ $(function() {
 <br>
 
 <%
+        }
     }
 
     ServletContext ocspContext = getServletContext().getContext("/ocsp");
-    String ocspName = ocspContext.getServletContextName();
-    String ocspPath = ocspContext.getContextPath();
-    if (!"".equals(ocspPath) && request.isSecure()) {
+    if (ocspContext != null) {
+        String ocspName = ocspContext.getServletContextName();
+        String ocspPath = ocspContext.getContextPath();
+        if (!"".equals(ocspPath) && request.isSecure()) {
 %>
 <p>
 <font size="+1" face="PrimaSans BT, Verdana, Arial, Helvetica, sans-serif">
@@ -191,12 +196,14 @@ $(function() {
 <br>
 
 <%
+        }
     }
 
     ServletContext tksContext = getServletContext().getContext("/tks");
-    String tksName = tksContext.getServletContextName();
-    String tksPath = tksContext.getContextPath();
-    if (!"".equals(tksPath) && request.isSecure()) {
+    if (tksContext != null) {
+        String tksName = tksContext.getServletContextName();
+        String tksPath = tksContext.getContextPath();
+        if (!"".equals(tksPath) && request.isSecure()) {
 %>
 <p>
 <font size="+1" face="PrimaSans BT, Verdana, Arial, Helvetica, sans-serif">
@@ -222,12 +229,14 @@ $(function() {
 <br>
 
 <%
+        }
     }
 
     ServletContext tpsContext = getServletContext().getContext("/tps");
-    String tpsName = tpsContext.getServletContextName();
-    String tpsPath = tpsContext.getContextPath();
-    if (!"".equals(tpsPath) && request.isSecure()) {
+    if (tpsContext != null) {
+        String tpsName = tpsContext.getServletContextName();
+        String tpsPath = tpsContext.getContextPath();
+        if (!"".equals(tpsPath) && request.isSecure()) {
 %>
 <p>
 <font size="+1" face="PrimaSans BT, Verdana, Arial, Helvetica, sans-serif">
@@ -247,6 +256,7 @@ $(function() {
 <br>
 
 <%
+        }
     }
 %>
 
-- 
1.9.3



More information about the Pki-devel mailing list