Commit f349304a authored by shangying's avatar shangying

sonar问题修改11

parent db0e7263
...@@ -114,6 +114,9 @@ public class EnvUtil { ...@@ -114,6 +114,9 @@ public class EnvUtil {
for (Map.Entry<Object, Object> property : propertySet) { for (Map.Entry<Object, Object> property : propertySet) {
String propertyKey = property.getKey().toString(); String propertyKey = property.getKey().toString();
String lowerCase=ciEnv.toLowerCase(); String lowerCase=ciEnv.toLowerCase();
if(StringUtils.isBlank(lowerCase)){
return env;
}
if (propertyKey.toLowerCase().contains(String.format("dubbo.%s.%s.",siteName.toLowerCase(),lowerCase))) { if (propertyKey.toLowerCase().contains(String.format("dubbo.%s.%s.",siteName.toLowerCase(),lowerCase))) {
// �������÷��� // �������÷���
env = propertyKey.split("\\.")[2]; env = propertyKey.split("\\.")[2];
...@@ -139,6 +142,9 @@ public class EnvUtil { ...@@ -139,6 +142,9 @@ public class EnvUtil {
for (Map.Entry<Object, Object> property : propertySet) { for (Map.Entry<Object, Object> property : propertySet) {
String propertyKey = property.getKey().toString(); String propertyKey = property.getKey().toString();
String lowerCase=ciEnv.toLowerCase(); String lowerCase=ciEnv.toLowerCase();
if(StringUtils.isBlank(lowerCase)){
return env;
}
if (propertyKey.toLowerCase().contains(String.format("http.%s.%s.",siteName.toLowerCase(),lowerCase))) { if (propertyKey.toLowerCase().contains(String.format("http.%s.%s.",siteName.toLowerCase(),lowerCase))) {
// �������÷���,�����ַ�������Сд // �������÷���,�����ַ�������Сд
env = propertyKey.split("\\.")[2]; env = propertyKey.split("\\.")[2];
......
...@@ -189,19 +189,12 @@ public class HttpService { ...@@ -189,19 +189,12 @@ public class HttpService {
}else { }else {
result = doResponse(response, urlString); result = doResponse(response, urlString);
// 得到响应状态码 // 得到响应状态码
int statuCode = response.getStatusLine().getStatusCode();
if(!Objects.isNull(statuCode)){
resultEntity.setStatusCode(statuCode);
}else {
log.info("返回的数据有问题statuCode={}",statuCode);
}
resultEntity.setResponseString(result);
resultEntity.setCookies(cookieStore.getCookies());
if(!Objects.isNull(response.getStatusLine())) { if(!Objects.isNull(response.getStatusLine())) {
resultEntity.setStatusCode(response.getStatusLine().getStatusCode()); resultEntity.setStatusCode(response.getStatusLine().getStatusCode());
} }
resultEntity.setResponseString(result);
resultEntity.setCookies(cookieStore.getCookies());
} }
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
...@@ -220,15 +213,13 @@ public class HttpService { ...@@ -220,15 +213,13 @@ public class HttpService {
if (response != null) { if (response != null) {
try { try {
response.close(); response.close();
httpGet.abort();
} catch (IOException e) { } catch (IOException e) {
// e.printStackTrace(); // e.printStackTrace();
log.info("异常信息e={}",e); log.info("异常信息e={}",e);
} }
} }
if(!Objects.isNull(httpGet)){
httpGet.abort();
}
} }
...@@ -299,16 +290,16 @@ public class HttpService { ...@@ -299,16 +290,16 @@ public class HttpService {
return resultEntity; return resultEntity;
}else { }else {
result = doResponse(response, url); result = doResponse(response, url);
resultEntity.setResponseString(result);
resultEntity.setCookies(cookieStore.getCookies());
if(!Objects.isNull(response.getStatusLine()) ) { if(!Objects.isNull(response.getStatusLine()) ) {
resultEntity.setStatusCode(response.getStatusLine().getStatusCode()); resultEntity.setStatusCode(response.getStatusLine().getStatusCode());
} }
resultEntity.setResponseString(result);
resultEntity.setCookies(cookieStore.getCookies());
} }
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); // ex.printStackTrace();
log.info("异常信息ex={}",ex);
} }
return resultEntity; return resultEntity;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment