Permalink
Browse files

check http status code before assuming bulk response is json

  • Loading branch information...
1 parent af75483 commit afc024d7bd223a8253ae0573701854b90abbdd53 @seancarr seancarr committed Sep 6, 2011
Binary file not shown.
@@ -300,6 +300,11 @@ private String bulkJsonResponse(String urlStr, String list) throws Exception {
wr.close();
rd.close();
+ int responseCode = handle.getResponseCode();
+ if (responseCode < 200 || responseCode > 299) {
+ throw new Exception("Error Code " + responseCode + ": " + sb.toString());
+ }
+
return sb.toString();
}

0 comments on commit afc024d

Please sign in to comment.