فهرست منبع

Support for anonymous saved versions

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.
Marc Egea i Sala 11 سال پیش
والد
کامیت
61a5c5870c
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/snapshot/getsavedvers/SnapshotInfo.java

+ 1 - 1
services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/snapshot/getsavedvers/SnapshotInfo.java

@@ -32,7 +32,7 @@ public class SnapshotInfo implements Comparable<SnapshotInfo> {
     }
     }
 
 
     public WLUser getUser() {
     public WLUser getUser() {
-        return user;
+        return user != null ? user : new WLUser();
     }
     }
 
 
     public String getCreatedAt() {
     public String getCreatedAt() {