minor fix

This commit is contained in:
DOHA 2015-02-23 15:28:11 +02:00
parent a818f035a4
commit 3b9ded093e
1 changed files with 6 additions and 5 deletions

View File

@ -135,16 +135,17 @@ public class RedditController {
String result = "";
JsonNode node = new ObjectMapper().readTree(responseBody);
JsonNode errorNode = node.get("json").get("errors").get(0);
if (errorNode != null) {
for (JsonNode child : errorNode) {
result = result + child.toString().replaceAll("\"|null", "") + "<br>";
}
if (result.length() == 0) {
return result;
} else {
if (node.get("json").get("data") != null && node.get("json").get("data").get("url") != null)
return "Post submitted successfully <a href=\"" + node.get("json").get("data").get("url").asText() + "\"> check it out </a>";
else
return "Error Occurred";
}
return result;
}
public void setRedditRestTemplate(OAuth2RestTemplate redditRestTemplate) {