File tree Expand file tree Collapse file tree 1 file changed +9
-15
lines changed Expand file tree Collapse file tree 1 file changed +9
-15
lines changed Original file line number Diff line number Diff line change @@ -91,22 +91,16 @@ protected Object doInBackground(Object... objects) {
9191 try {
9292 HttpResponse resp = roundtrip (mHttpRequest );
9393 int statusCode = resp .getStatusLine ().getStatusCode ();
94- if ( statusCode == 401 ) { // android 2.3 will not response
95- return new Exception ( "unauthorized!" );
96- }
97- byte [] data = EntityUtils . toByteArray ( resp . getEntity () );
94+ String xl = resp . getFirstHeader ( "X-Log" ). getValue ();
95+
96+ if ( statusCode == 401 ) return new Exception ( "unauthorized!" ); // android 2.3 will not response
97+ if ( xl . contains ( "invalid BlockCtx" )) return new Exception ( xl );
9898
99- if (statusCode / 100 != 2 ) {
100- if (data .length == 0 ) {
101- String xlog = resp .getFirstHeader ("X-Log" ).getValue ();
102- if (xlog .length () > 0 ) {
103- return new Exception (xlog );
104- }
105- return new Exception (resp .getStatusLine ().getReasonPhrase ());
106- }
107- return new Exception (new String (data ));
108- }
109- return data ;
99+ byte [] data = EntityUtils .toByteArray (resp .getEntity ());
100+ if (statusCode / 100 == 2 ) return data ;
101+ if (data .length > 0 ) return new Exception (new String (data ));
102+ if (xl .length () > 0 ) return new Exception (xl );
103+ return new Exception (resp .getStatusLine ().getStatusCode () + ":" + resp .getStatusLine ().getReasonPhrase ());
110104 } catch (IOException e ) {
111105 e .printStackTrace ();
112106 return e ;
You can’t perform that action at this time.
0 commit comments