summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/utils/JsonUtils.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gmail.com>2015-10-10 08:13:12 -0400
committerJames Moger <james.moger@gmail.com>2015-10-10 08:13:12 -0400
commita3a18a0ebfeb65777ad5bd065e26fa9c00e8100c (patch)
treef9c3d5112600f89f64ded2d56472664db185750a /src/main/java/com/gitblit/utils/JsonUtils.java
parentf2a9b239d2605b36401dd723ac22c195b938f8e0 (diff)
parentbd0e83e350fc703bcae72a28c41b09d9a9cec594 (diff)
downloadgitblit-a3a18a0ebfeb65777ad5bd065e26fa9c00e8100c.tar.gz
gitblit-a3a18a0ebfeb65777ad5bd065e26fa9c00e8100c.zip
Merge pull request #921 from paulsputer/git-lfs-support
Initial Git-LFS support
Diffstat (limited to 'src/main/java/com/gitblit/utils/JsonUtils.java')
-rw-r--r--src/main/java/com/gitblit/utils/JsonUtils.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/main/java/com/gitblit/utils/JsonUtils.java b/src/main/java/com/gitblit/utils/JsonUtils.java
index be7148cb..f389776b 100644
--- a/src/main/java/com/gitblit/utils/JsonUtils.java
+++ b/src/main/java/com/gitblit/utils/JsonUtils.java
@@ -46,6 +46,7 @@ import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
+import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
@@ -79,23 +80,29 @@ public class JsonUtils {
/**
* Convert a json string to an object of the specified type.
- *
+ *
* @param json
* @param clazz
- * @return an object
+ * @return the deserialized object
+ * @throws JsonParseException
+ * @throws JsonSyntaxException
*/
- public static <X> X fromJsonString(String json, Class<X> clazz) {
+ public static <X> X fromJsonString(String json, Class<X> clazz) throws JsonParseException,
+ JsonSyntaxException {
return gson().fromJson(json, clazz);
}
/**
* Convert a json string to an object of the specified type.
- *
+ *
* @param json
- * @param clazz
- * @return an object
+ * @param type
+ * @return the deserialized object
+ * @throws JsonParseException
+ * @throws JsonSyntaxException
*/
- public static <X> X fromJsonString(String json, Type type) {
+ public static <X> X fromJsonString(String json, Type type) throws JsonParseException,
+ JsonSyntaxException {
return gson().fromJson(json, type);
}