fixed deserialization issue caused from json to String
This commit is contained in:
parent
0674a3c031
commit
f88d9b8381
|
@ -287,16 +287,14 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
requestFilter.setEnglishname(englishName);
|
||||
|
||||
try {
|
||||
String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class);
|
||||
Map rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, Map.class);
|
||||
if (rs == null) {
|
||||
logger.error("DSM response is null : [url={}]", uriComponents.toUri());
|
||||
} else {
|
||||
JSONObject response = new JSONObject(rs);
|
||||
JSONArray jsonArray = (JSONArray) response.get("datasourceInfo");
|
||||
Header header = mapper.readValue(response.get("header").toString(), Header.class);
|
||||
Header header = mapper.readValue(mapper.writeValueAsString(rs.get("header")), Header.class);
|
||||
snippets = Paging.of(header,
|
||||
mapper.readValue(
|
||||
String.valueOf(jsonArray),
|
||||
mapper.writeValueAsString(rs.get("datasourceInfo")),
|
||||
mapper.getTypeFactory().constructCollectionType(List.class, RepositorySnippet.class)));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue