@Override
public void onResult(final int responseCode, final String responseMessage, final @Nullable InputStream inputStream) {
- if(responseCode!=200 || inputStream==null)
+ if(responseCode != 200 || inputStream==null){
+ if(responseCode != 204)
+ throw new RuntimeException("Bad HTTP response code: "+responseCode);
return;
+ }
final Handler handler=new Handler(Looper.getMainLooper());
final JSONArray jsonargs=object.getJSONArray("args");
final String command=object.getString("command");
- final Address replyTo=new Address(toNonNull(Protocol.HTTP), object.getString("replyto"));//NOPMD address depends on command
+ final Address replyTo=new Address(toNonNull(Protocol.HTTP), object.getString("replyto"), object.has("requestid") ? object.getString("requestid") : null);//NOPMD address depends on command
final String[] args=new String[jsonargs.length()];
for(int j=0;j<args.length;j++)
args[j]=jsonargs.getString(j);
@Override
public void onError(final String error) {
Log.e("PollResultCallback", "onError: "+error);
+ throw new RuntimeException(error);
}
}