Skip to content

Commit

Permalink
add try cache for parsing json
Browse files Browse the repository at this point in the history
  • Loading branch information
maxis7567 committed May 15, 2019
1 parent e0df06c commit bfae892
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 32 deletions.
29 changes: 0 additions & 29 deletions .idea/codeStyles/Project.xml

This file was deleted.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {

}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Jan 20 12:03:17 IRST 2019
#Wed May 15 11:38:50 IRDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

import com.android.volley.AuthFailureError;
import com.android.volley.ParseError;
import com.android.volley.VolleyError;
import com.google.gson.Gson;
import com.google.gson.JsonParseException;

import java.io.UnsupportedEncodingException;
import java.lang.reflect.Type;
Expand Down Expand Up @@ -58,6 +60,8 @@ protected Response<T> parseNetworkResponse(NetworkResponse response) {
return Response.success(respone, null);
} catch (UnsupportedEncodingException e) {
return Response.error(new ParseError(e));
}catch (JsonParseException e){
return Response.error(new VolleyError(e.getMessage()));
}
}

Expand Down

0 comments on commit bfae892

Please sign in to comment.