minor fix
This commit is contained in:
parent
a818f035a4
commit
3b9ded093e
|
@ -135,16 +135,17 @@ public class RedditController {
|
||||||
String result = "";
|
String result = "";
|
||||||
JsonNode node = new ObjectMapper().readTree(responseBody);
|
JsonNode node = new ObjectMapper().readTree(responseBody);
|
||||||
JsonNode errorNode = node.get("json").get("errors").get(0);
|
JsonNode errorNode = node.get("json").get("errors").get(0);
|
||||||
|
if (errorNode != null) {
|
||||||
for (JsonNode child : errorNode) {
|
for (JsonNode child : errorNode) {
|
||||||
result = result + child.toString().replaceAll("\"|null", "") + "<br>";
|
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)
|
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>";
|
return "Post submitted successfully <a href=\"" + node.get("json").get("data").get("url").asText() + "\"> check it out </a>";
|
||||||
else
|
else
|
||||||
return "Error Occurred";
|
return "Error Occurred";
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRedditRestTemplate(OAuth2RestTemplate redditRestTemplate) {
|
public void setRedditRestTemplate(OAuth2RestTemplate redditRestTemplate) {
|
||||||
|
|
Loading…
Reference in New Issue