|
|
@ -108,12 +108,10 @@ public class FragmentDialogUnsubscribe extends FragmentDialogBase {
|
|
|
|
connection.getOutputStream().write(request.getBytes());
|
|
|
|
connection.getOutputStream().write(request.getBytes());
|
|
|
|
|
|
|
|
|
|
|
|
int status = connection.getResponseCode();
|
|
|
|
int status = connection.getResponseCode();
|
|
|
|
if (status >= 400) {
|
|
|
|
if (status >= 300) {
|
|
|
|
String error = "Error " + status + ": " + connection.getResponseMessage();
|
|
|
|
String error = status + ": " + connection.getResponseMessage();
|
|
|
|
Log.i("Unsubscribe error=" + error);
|
|
|
|
Log.i("Unsubscribe error=" + error);
|
|
|
|
InputStream stream = connection.getErrorStream();
|
|
|
|
throw new IllegalArgumentException(error);
|
|
|
|
String detail = (stream == null || status == 404 ? null : Helper.readStream(stream));
|
|
|
|
|
|
|
|
throw new IOException(error + " " + detail);
|
|
|
|
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
Log.i("Unsubscribe status=" + status);
|
|
|
|
Log.i("Unsubscribe status=" + status);
|
|
|
|
|
|
|
|
|
|
|
@ -132,7 +130,12 @@ public class FragmentDialogUnsubscribe extends FragmentDialogBase {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onException(Bundle args, Throwable ex) {
|
|
|
|
protected void onException(Bundle args, Throwable ex) {
|
|
|
|
dialog.dismiss();
|
|
|
|
dialog.dismiss();
|
|
|
|
Log.unexpectedError(getParentFragmentManager(), ex);
|
|
|
|
if (ex instanceof IllegalArgumentException)
|
|
|
|
|
|
|
|
ToastEx.makeText(context,
|
|
|
|
|
|
|
|
context.getString(R.string.title_unsubscribe_error, ex.getMessage()),
|
|
|
|
|
|
|
|
Toast.LENGTH_LONG).show();
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
Log.unexpectedError(getParentFragmentManager(), ex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}.execute(FragmentDialogUnsubscribe.this, args, "unsubscribe");
|
|
|
|
}.execute(FragmentDialogUnsubscribe.this, args, "unsubscribe");
|
|
|
|
}
|
|
|
|
}
|
|
|
|