return -1;
}
}
private static void reportError(Exception e, URL url, HttpResponse response) {
FirefoxErrorContent error = FirefoxErrorContent.GENERIC;
if (e instanceof UnknownHostException) {
error = FirefoxErrorContent.DNS_NOT_FOUND;
} else if (e instanceof ConnectException) {
error = FirefoxErrorContent.CONN_FAILURE;
} else if (e instanceof ConnectTimeoutException) {
error = FirefoxErrorContent.NET_TIMEOUT;
} else if (e instanceof NoHttpResponseException) {
error = FirefoxErrorContent.NET_RESET;
} else if (e instanceof EOFException) {
error = FirefoxErrorContent.NET_INTERRUPT;
} else if (e instanceof IllegalArgumentException && e.getMessage().startsWith("Host name may not be null")){
error = FirefoxErrorContent.DNS_NOT_FOUND;
} else if (e instanceof BadURIException){
error = FirefoxErrorContent.MALFORMED_URI;
}
String shortDesc = String.format(error.getShortDesc(), url.getHost());
String text = String.format(FirefoxErrorConstants.ERROR_PAGE, error.getTitle(), shortDesc, error.getLongDesc());
try {
response.setStatus(HttpResponse.__502_Bad_Gateway);
response.setContentLength(text.length());