아래와 같이 에러인 경우와 아닌경우를 나눠서 처리하면 될것 같네요.
에러인 경우 응답코드를 가져와서 처리해야합니다
try
{
inputStream = urlConn.getInputStream();
}
catch (IOException ioe)
{
urlConn.disconnect();
// If HTTP response code '401' is returned then try to resume the expired
// session on the reporting server by obtaining a new HTTP URL Connection.
if (urlConn.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED)
{
throw new ClusterException("The access to the requested resource was denied; the request may have been made without authorization credentials.");
}
// If response code other than '401' is returned then propagate the IOException to the next level.
else
{
throw new ClusterException(ioe.getMessage());
}
}