Commit 37764014 authored by Dave Cridland's avatar Dave Cridland

Merge pull request #236 from AndiHeusser/of889

Prevent sessions in admin console from showing UnknownHostException
parents 34286d24 7037e77f
...@@ -151,9 +151,13 @@ ...@@ -151,9 +151,13 @@
<fmt:message key="session.details.hostname" /> <fmt:message key="session.details.hostname" />
</td> </td>
<td> <td>
<%= StringUtils.escapeHTMLTags(componentSession.getHostAddress()) %> <% try { %>
/ <%= StringUtils.escapeHTMLTags(componentSession.getHostAddress()) %>
<%= StringUtils.escapeHTMLTags(componentSession.getHostName()) %> /
<%= StringUtils.escapeHTMLTags(componentSession.getHostName()) %>
<% } catch (java.net.UnknownHostException e) { %>
Invalid session/connection
<% } %>
</td> </td>
</tr> </tr>
</tbody> </tbody>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
org.jivesoftware.openfire.session.OutgoingServerSession, org.jivesoftware.openfire.session.OutgoingServerSession,
org.jivesoftware.util.JiveGlobals, org.jivesoftware.util.JiveGlobals,
org.jivesoftware.util.ParamUtils, org.jivesoftware.util.ParamUtils,
java.text.NumberFormat" java.text.NumberFormat"
errorPage="error.jsp" errorPage="error.jsp"
%> %>
<%@ page import="java.util.Calendar" %> <%@ page import="java.util.Calendar" %>
...@@ -99,14 +99,18 @@ ...@@ -99,14 +99,18 @@
<fmt:message key="server.session.details.hostname" /> <fmt:message key="server.session.details.hostname" />
</td> </td>
<td> <td>
<% if (!inSessions.isEmpty()) { %> <% try {
<%= inSessions.get(0).getHostAddress() %> if (!inSessions.isEmpty()) { %>
/ <%= inSessions.get(0).getHostAddress() %>
<%= inSessions.get(0).getHostName() %> /
<% } else if (outSession != null) { %> <%= inSessions.get(0).getHostName() %>
<%= outSession.getHostAddress() %> <% } else if (outSession != null) { %>
/ <%= outSession.getHostAddress() %>
<%= outSession.getHostName() %> /
<%= outSession.getHostName() %>
<% }
} catch (java.net.UnknownHostException e) { %>
Invalid session/connection
<% } %> <% } %>
</td> </td>
</tr> </tr>
......
...@@ -281,9 +281,13 @@ ...@@ -281,9 +281,13 @@
<fmt:message key="session.details.hostname" /> <fmt:message key="session.details.hostname" />
</td> </td>
<td> <td>
<%= currentSess.getHostAddress() %> <% try { %>
/ <%= currentSess.getHostAddress() %>
<%= currentSess.getHostName() %> /
<%= currentSess.getHostName() %>
<% } catch (java.net.UnknownHostException e) { %>
Invalid session/connection
<% } %>
</td> </td>
</tr> </tr>
</tbody> </tbody>
......
...@@ -168,7 +168,11 @@ ...@@ -168,7 +168,11 @@
</td> </td>
<td width="1%" nowrap> <td width="1%" nowrap>
<%= sess.getHostAddress() %> <% try { %>
<%= sess.getHostAddress() %>
<% } catch (java.net.UnknownHostException e) { %>
Invalid session/connection
<% } %>
</td> </td>
<td width="1%" nowrap align="center" style="border-right:1px #ccc solid;"> <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