Senhores, tenho uma rotina que recupera o html de um determinado site, repentinamente esta rotina parou de funcionar, segue trecho do código:
String strHtml = "";
String url = "";
byte[] responseBody = null;
url = "http://www.google.com.br";
HttpClient client = new HttpClient();
GetMethod get = new GetMethod(url);
// Provide custom retry handler is necessary
get.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false));
// Execute the method.
int statusCode = client.executeMethod(get);
if (statusCode != HttpStatus.SC_OK) {
System.err.println("Method failed: " + get.getStatusLine());
}
// Read the response body.
responseBody = get.getResponseBody();
// Seta o padrão de codificação da página iso 8859-1
strHtml = new String(responseBody, "iso-8859-1");
Na linha:
GetMethod get = new GetMethod(url);
ocorre um erro que não consigo capturar com try
Desde já agradeço qualquer ajuda.