Skip to content

Commit

Permalink
Merge pull request #236 from AndiHeusser/of889
Browse files Browse the repository at this point in the history
Prevent sessions in admin console from showing UnknownHostException
  • Loading branch information
dwd committed Jun 15, 2015
2 parents 34286d2 + 7037e77 commit 3776401
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 16 deletions.
10 changes: 7 additions & 3 deletions src/web/component-session-details.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
22 changes: 13 additions & 9 deletions src/web/server-session-details.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -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" %>
Expand Down Expand Up @@ -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>
Expand Down
10 changes: 7 additions & 3 deletions src/web/session-details.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 5 additions & 1 deletion src/web/session-row.jspf
Original file line number Diff line number Diff line change
Expand Up @@ -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;">
Expand Down

0 comments on commit 3776401

Please sign in to comment.