Commit 7037e77f authored by andi@symphono.com's avatar andi@symphono.com

OF-889: Added try-catch blocks to the various JSP pages where...

OF-889: Added try-catch blocks to the various JSP pages where Session.getHostName or Session.getHostAddress is called to prevent the Sessions tab from showing UnknownHostExceptions when there are bad client sessions laying around
parent 34286d24
......@@ -151,9 +151,13 @@
<fmt:message key="session.details.hostname" />
</td>
<td>
<%= StringUtils.escapeHTMLTags(componentSession.getHostAddress()) %>
/
<%= StringUtils.escapeHTMLTags(componentSession.getHostName()) %>
<% try { %>
<%= StringUtils.escapeHTMLTags(componentSession.getHostAddress()) %>
/
<%= StringUtils.escapeHTMLTags(componentSession.getHostName()) %>
<% } catch (java.net.UnknownHostException e) { %>
Invalid session/connection
<% } %>
</td>
</tr>
</tbody>
......
......@@ -22,7 +22,7 @@
org.jivesoftware.openfire.session.OutgoingServerSession,
org.jivesoftware.util.JiveGlobals,
org.jivesoftware.util.ParamUtils,
java.text.NumberFormat"
java.text.NumberFormat"
errorPage="error.jsp"
%>
<%@ page import="java.util.Calendar" %>
......@@ -99,14 +99,18 @@
<fmt:message key="server.session.details.hostname" />
</td>
<td>
<% if (!inSessions.isEmpty()) { %>
<%= inSessions.get(0).getHostAddress() %>
/
<%= inSessions.get(0).getHostName() %>
<% } else if (outSession != null) { %>
<%= outSession.getHostAddress() %>
/
<%= outSession.getHostName() %>
<% try {
if (!inSessions.isEmpty()) { %>
<%= inSessions.get(0).getHostAddress() %>
/
<%= inSessions.get(0).getHostName() %>
<% } else if (outSession != null) { %>
<%= outSession.getHostAddress() %>
/
<%= outSession.getHostName() %>
<% }
} catch (java.net.UnknownHostException e) { %>
Invalid session/connection
<% } %>
</td>
</tr>
......
......@@ -281,9 +281,13 @@
<fmt:message key="session.details.hostname" />
</td>
<td>
<%= currentSess.getHostAddress() %>
/
<%= currentSess.getHostName() %>
<% try { %>
<%= currentSess.getHostAddress() %>
/
<%= currentSess.getHostName() %>
<% } catch (java.net.UnknownHostException e) { %>
Invalid session/connection
<% } %>
</td>
</tr>
</tbody>
......
......@@ -168,7 +168,11 @@
</td>
<td width="1%" nowrap>
<%= sess.getHostAddress() %>
<% try { %>
<%= sess.getHostAddress() %>
<% } catch (java.net.UnknownHostException e) { %>
Invalid session/connection
<% } %>
</td>
<td width="1%" nowrap align="center" style="border-right:1px #ccc solid;">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment