summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Lohre2011-05-06 11:14:04 (EDT)
committerJan Lohre2011-05-06 11:46:46 (EDT)
commit503c99ebd10903226c9acf8cd0c9ac0a841beaf9 (patch)
tree1aa25569aab3e54eefd8fa799aa79dc1c8e48bb5
parent8cd048d30592e168cc840e7ee5e21c28678459fd (diff)
downloadorg.eclipse.mylyn.reviews-503c99ebd10903226c9acf8cd0c9ac0a841beaf9.zip
org.eclipse.mylyn.reviews-503c99ebd10903226c9acf8cd0c9ac0a841beaf9.tar.gz
org.eclipse.mylyn.reviews-503c99ebd10903226c9acf8cd0c9ac0a841beaf9.tar.bz2
bug 344979: Gerrit timestamps are broken
Created a custom deserializer using the JavaSqlTimestamp_JsonSerializer.parseTimestamp method.
-rw-r--r--gerrit/org.eclipse.mylyn.gerrit.core/META-INF/MANIFEST.MF1
-rw-r--r--gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/JSonSupport.java10
2 files changed, 11 insertions, 0 deletions
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/META-INF/MANIFEST.MF b/gerrit/org.eclipse.mylyn.gerrit.core/META-INF/MANIFEST.MF
index b9fa90b..97b8269 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.core/META-INF/MANIFEST.MF
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/META-INF/MANIFEST.MF
@@ -30,6 +30,7 @@ Import-Package: com.google.gerrit.common.auth.userpass;version="2.1.5",
com.google.gson.reflect;version="1.6.0",
com.google.gwt.user.client.rpc,
com.google.gwtjsonrpc.client;version="1.2.2",
+ com.google.gwtjsonrpc.client.impl.ser;version="1.2.2",
com.google.gwtjsonrpc.server;version="1.2.2",
com.google.gwtorm.client;version="1.1.4",
com.google.gwtorm.server;version="1.1.4"
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/JSonSupport.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/JSonSupport.java
index 422df45..3895880 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/JSonSupport.java
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/JSonSupport.java
@@ -13,6 +13,7 @@
package org.eclipse.mylyn.internal.gerrit.core.client;
import java.lang.reflect.Type;
+import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -28,6 +29,7 @@ import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
+import com.google.gwtjsonrpc.client.impl.ser.JavaSqlTimestamp_JsonSerializer;
import com.google.gwtjsonrpc.server.JsonServlet;
/**
@@ -116,6 +118,14 @@ public class JSonSupport {
return new Edit(0, 0);
}
})
+ .registerTypeAdapter(Timestamp.class, new JsonDeserializer<Timestamp>() {
+
+ @Override
+ public Timestamp deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
+ throws JsonParseException {
+ return new JavaSqlTimestamp_JsonSerializer().fromJson(json.getAsString());
+ }
+ })
.setExclusionStrategies(exclustionStrategy)
.create();
}