From 61a5c5870c7363034eb20b19b54b3df6e622da39 Mon Sep 17 00:00:00 2001 From: Marc Egea i Sala Date: Fri, 25 Sep 2015 16:15:37 +0100 Subject: [PATCH] Support for anonymous saved versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a case when de API sends a version without user. There was a bug allowing to create anonymous versions in the application and we have to support the old data. The problem here is that SnapshotInfo classes are inflated from json via Gson. This method does not call any constructor and, since the json does not include the ‘user’ key, the bridge crashes because we’re not expecting null users. I’m not happy with this fix, but is the minimum solution that does not affect anything else. --- .../ac/ic/wlgitbridge/snapshot/getsavedvers/SnapshotInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/snapshot/getsavedvers/SnapshotInfo.java b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/snapshot/getsavedvers/SnapshotInfo.java index f64665cc71..9fae0a15a2 100644 --- a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/snapshot/getsavedvers/SnapshotInfo.java +++ b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/snapshot/getsavedvers/SnapshotInfo.java @@ -32,7 +32,7 @@ public class SnapshotInfo implements Comparable { } public WLUser getUser() { - return user; + return user != null ? user : new WLUser(); } public String getCreatedAt() {