【fix sonar】JeroElasticsearchTemplate文件
This commit is contained in:
+4
-4
@@ -144,7 +144,7 @@ public class JeroElasticsearchTemplate {
|
|||||||
if (found) {
|
if (found) {
|
||||||
return result.getJSONObject("_source");
|
return result.getJSONObject("_source");
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return new JSONObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,7 +245,7 @@ public class JeroElasticsearchTemplate {
|
|||||||
} catch (org.springframework.web.client.HttpClientErrorException e) {
|
} catch (org.springframework.web.client.HttpClientErrorException e) {
|
||||||
String message = e.getMessage();
|
String message = e.getMessage();
|
||||||
if (message != null && message.contains("404 Not Found")) {
|
if (message != null && message.contains("404 Not Found")) {
|
||||||
return null;
|
return new JSONObject();
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
@@ -380,7 +380,7 @@ public class JeroElasticsearchTemplate {
|
|||||||
data.remove("id");
|
data.remove("id");
|
||||||
bodySB.append(data.toJSONString()).append("\n");
|
bodySB.append(data.toJSONString()).append("\n");
|
||||||
}
|
}
|
||||||
System.out.println("+-+-+-: bodySB.toString(): " + bodySB.toString());
|
log.info("+-+-+-: bodySB.toString(): " + bodySB.toString());
|
||||||
HttpHeaders headers = RestUtil.getHeaderApplicationJson();
|
HttpHeaders headers = RestUtil.getHeaderApplicationJson();
|
||||||
RestUtil.request(url, HttpMethod.PUT, headers, null, bodySB, JSONObject.class);
|
RestUtil.request(url, HttpMethod.PUT, headers, null, bodySB, JSONObject.class);
|
||||||
return true;
|
return true;
|
||||||
@@ -481,7 +481,7 @@ public class JeroElasticsearchTemplate {
|
|||||||
*/
|
*/
|
||||||
public JSONObject buildQueryString(String field, String... args) {
|
public JSONObject buildQueryString(String field, String... args) {
|
||||||
if (field == null) {
|
if (field == null) {
|
||||||
return null;
|
return new JSONObject();
|
||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder(field).append(":(");
|
StringBuilder sb = new StringBuilder(field).append(":(");
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user