Skip to content

Commit b625869

Browse files
author
Devendra
committed
try parsing time api response before passing to success callback
1 parent 569cb15 commit b625869

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎java/srcPubnubApi/srcCore/com/pubnub/api/PubnubCore.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,13 @@ protected JSONArray _time(Callback callback, boolean sync) {
325325
HttpRequest hreq = new HttpRequest(url, params, new ResponseHandler() {
326326

327327
public void handleResponse(HttpRequest hreq, String response) {
328+
JSONArray jsarr;
329+
try {
330+
jsarr = new JSONArray(response);
331+
} catch (JSONException e) {
332+
handleError(hreq, PubnubError.getErrorObject(PubnubError.PNERROBJ_INVALID_JSON, 7, response));
333+
return;
334+
}
328335
cb.successCallback(null, response);
329336
}
330337

0 commit comments

Comments
 (0)