From bfae89259fd56ff3af542716b428f1bc74f21fb8 Mon Sep 17 00:00:00 2001 From: maxis7567 Date: Wed, 15 May 2019 11:59:06 +0430 Subject: [PATCH] add try cache for parsing json --- .idea/codeStyles/Project.xml | 29 ------------------- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 +-- .../com/maxis7567/msvolley/JsonRequest.java | 4 +++ 4 files changed, 7 insertions(+), 32 deletions(-) delete mode 100644 .idea/codeStyles/Project.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index 30aa626..0000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/build.gradle b/build.gradle index d3e5760..bda474e 100644 --- a/build.gradle +++ b/build.gradle @@ -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 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 16e3a53..cfdd577 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/msvolley/src/main/java/com/maxis7567/msvolley/JsonRequest.java b/msvolley/src/main/java/com/maxis7567/msvolley/JsonRequest.java index 2be3de3..9f69931 100644 --- a/msvolley/src/main/java/com/maxis7567/msvolley/JsonRequest.java +++ b/msvolley/src/main/java/com/maxis7567/msvolley/JsonRequest.java @@ -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; @@ -58,6 +60,8 @@ protected Response 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())); } }