【fix sonar】JeroElasticsearchTemplate文件

This commit is contained in:
梁琦涛
2023-03-08 12:02:15 +08:00
parent 2999d4254e
commit 74d09a897a
@@ -144,7 +144,7 @@ public class JeroElasticsearchTemplate {
if (found) {
return result.getJSONObject("_source");
} else {
return null;
return new JSONObject();
}
}
@@ -245,7 +245,7 @@ public class JeroElasticsearchTemplate {
} catch (org.springframework.web.client.HttpClientErrorException e) {
String message = e.getMessage();
if (message != null && message.contains("404 Not Found")) {
return null;
return new JSONObject();
}
throw e;
}
@@ -380,7 +380,7 @@ public class JeroElasticsearchTemplate {
data.remove("id");
bodySB.append(data.toJSONString()).append("\n");
}
System.out.println("+-+-+-: bodySB.toString(): " + bodySB.toString());
log.info("+-+-+-: bodySB.toString(): " + bodySB.toString());
HttpHeaders headers = RestUtil.getHeaderApplicationJson();
RestUtil.request(url, HttpMethod.PUT, headers, null, bodySB, JSONObject.class);
return true;
@@ -481,7 +481,7 @@ public class JeroElasticsearchTemplate {
*/
public JSONObject buildQueryString(String field, String... args) {
if (field == null) {
return null;
return new JSONObject();
}
StringBuilder sb = new StringBuilder(field).append(":(");
if (args != null) {