So I'm calling a rest web service via HttpURLConnection which responds with a 400 status code if you try to post data which has already been processed, along with the status code it also returns a JSON response in along the lines of:
{
"statusCode": 400,
"errorCode": "REQUEST_VALIDATION_ERROR",
"message": "validation failed",
"developerMessage": " MessageId-xxx already processed. No Need to process again."
}
So I try calling this with HttpURLConnection and when I call getInputStream it throws an exception, saying that the 400 status code was result. That is true. But I am trying to get and parse the content. I don't want it to throw an exception. Is there another way to get the content of the response? Or is there as way to tell it to go ahead and give me the stream because I know the status is 400? Some way to suppress the throwing of the exception?