@@ -100,7 +100,8 @@ public void onSuccess(int statusCode, Header[] headers, String responseBody) {
100
100
@ Override
101
101
public void onSuccess (int statusCode , Header [] headers , byte [] responseBody ) {
102
102
try {
103
- onSuccess (statusCode , headers , new String (responseBody , getCharset ()));
103
+ String response = responseBody == null ? null : new String (responseBody , getCharset ());
104
+ onSuccess (statusCode , headers , response );
104
105
} catch (UnsupportedEncodingException e ) {
105
106
Log .v (LOG_TAG , "String encoding failed, calling onFailure(int, Header[], String, Throwable)" );
106
107
onFailure (0 , headers , (String ) null , e );
@@ -110,7 +111,8 @@ public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
110
111
@ Override
111
112
public void onFailure (int statusCode , Header [] headers , byte [] responseBody , Throwable error ) {
112
113
try {
113
- onFailure (statusCode , headers , new String (responseBody , getCharset ()), error );
114
+ String response = responseBody == null ? null : new String (responseBody , getCharset ());
115
+ onFailure (statusCode , headers , response , error );
114
116
} catch (UnsupportedEncodingException e ) {
115
117
Log .v (LOG_TAG , "String encoding failed, calling onFailure(int, Header[], String, Throwable)" );
116
118
onFailure (0 , headers , (String ) null , e );
0 commit comments