errmsg = ErrorCodeEnum.errorMsg(conn.getResponseCode());
errmsg = errmsg == null ? conn.getHeaderField(0) : errmsg;
}else{
errmsg = conn.getHeaderField(0);
}
BaseResult result = new BaseResult(errmsg,conn.getResponseCode());
return result.toString();
}
}
catch (SocketTimeoutException e) {
logger.log(Level.SEVERE,"God! the server throw SocketTimeout Exception." +
"please check it out the error message:"+e.getMessage());
BaseResult baseResult = new BaseResult(e.getMessage().toString(),ErrorCodeEnum.CONNECTIONTIMEOUT.value());
return baseResult.toString();
}
catch (ConnectException e) {
logger.log(Level.SEVERE,"God! the server throw Connect Exception ." +
"please check it out the error message:"+e.getMessage());
BaseResult baseResult = new BaseResult(e.getMessage().toString(),ErrorCodeEnum.CONNECTIONREFUSED.value());
return baseResult.toString();
}
catch (UnknownHostException e) {
logger.log(Level.SEVERE,"God! the server throw UnknownHost Exception ." +
"please check it out the error message:"+e.getMessage());
BaseResult baseResult = new BaseResult(e.getMessage().toString(),ErrorCodeEnum.CONNECTIONREFUSED.value());
return baseResult.toString();
}
catch (Exception e) {
logger.log(Level.SEVERE,"God! the server throw exception." +
"please check it out the error message:"+e.getMessage());
BaseResult baseResult = new BaseResult(e.getMessage().toString(),ErrorCodeEnum.UnknownException.value());
return baseResult.toString();
}
finally {
if (null != outStream) {
try {
outStream.close();