Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

Commit

Permalink
Added logs for jsonhelper + fixed dependency graph issue using newer …
Browse files Browse the repository at this point in the history
…mockito version
  • Loading branch information
AlexanderEggers committed May 7, 2020
1 parent 37a04d9 commit 501dc11
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ buildscript {
autotarget_version = '1.0.0-rc5'

junit_version = "4.13"
mockito_version = '3.3.10'
mockito_version = '3.2.0'
powermock_version = '2.0.2'
support_lib_lifecycle_testing_version = '2.1.0'

archtree_library_version = "1.0.0-beta8"
archtree_library_version = "1.0.0-beta9"
}

repositories {
Expand Down
6 changes: 5 additions & 1 deletion helper-core/src/main/java/archtree/helper/JsonHelper.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package archtree.helper

import android.content.Context
import android.util.Log
import androidx.annotation.WorkerThread
import com.google.gson.Gson
import com.google.gson.JsonArray
Expand All @@ -13,6 +14,7 @@ class JsonHelper(private val context: Context, private val gson: Gson) {
return try {
gson.fromJson(value, type)
} catch (e: Exception) {
Log.e(JsonHelper::class.java.name, "Exception when parsing data: ${e.message} ${e.printStackTrace()}")
null
}
}
Expand All @@ -22,6 +24,7 @@ class JsonHelper(private val context: Context, private val gson: Gson) {
return try {
gson.toJsonTree(value).asJsonArray
} catch (e: Exception) {
Log.e(JsonHelper::class.java.name, "Exception when parsing data: ${e.message} ${e.printStackTrace()}")
null
}
}
Expand All @@ -44,7 +47,8 @@ class JsonHelper(private val context: Context, private val gson: Gson) {
context.assets?.open(fileName)?.bufferedReader()?.use { reader ->
reader.readText()
}
} catch (ignore: Exception) {
} catch (e: Exception) {
Log.e(JsonHelper::class.java.name, "Exception when parsing data: ${e.message} ${e.printStackTrace()}")
null
}
}
Expand Down

0 comments on commit 501dc11

Please sign in to comment.