Paul Martin
2016-04-27 c2188a840bc4153ae92112b04b2e06a90d3944aa
src/main/java/com/gitblit/utils/JsonUtils.java
@@ -46,6 +46,7 @@
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 @@
   /**
    * 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);
   }
@@ -274,10 +281,10 @@
      return builder.create();
   }
   private static class GmtDateTypeAdapter implements JsonSerializer<Date>, JsonDeserializer<Date> {
   public static class GmtDateTypeAdapter implements JsonSerializer<Date>, JsonDeserializer<Date> {
      private final DateFormat dateFormat;
      private GmtDateTypeAdapter() {
      public GmtDateTypeAdapter() {
         dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
         dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
      }