resolve compilation issues with statistics servlet post patch application

This commit is contained in:
Jesse McConnell 2013-01-29 15:48:33 -06:00
parent dd4a80288b
commit c87cc4d4f0
1 changed files with 12 additions and 2 deletions

View File

@ -22,6 +22,8 @@ import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean; import java.lang.management.MemoryMXBean;
import java.net.InetAddress;
import java.net.UnknownHostException;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.ServletException; import javax.servlet.ServletException;
@ -113,8 +115,16 @@ public class StatisticsServlet extends HttpServlet
private boolean isLoopbackAddress(String address) private boolean isLoopbackAddress(String address)
{ {
InetAddress address = InetAddress.getByName(address); try
return address.isLoopbackAddress(); {
InetAddress addr = InetAddress.getByName(address);
return addr.isLoopbackAddress();
}
catch (UnknownHostException e )
{
LOG.warn("Warning: attempt to access statistics servlet from " + address, e);
return false;
}
} }
private void sendXmlResponse(HttpServletResponse response) throws IOException private void sendXmlResponse(HttpServletResponse response) throws IOException