【fix sonar】JeroElasticsearchTemplate文件
This commit is contained in:
+4
-4
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user