From fa2d2275271decaf81196537ab4fe98ab1ce939e Mon Sep 17 00:00:00 2001 From: iwakeh Date: Mon, 26 Dec 2016 13:11:34 +0100 Subject: [PATCH] Make tests pass again. Gson demands no-args constructors. --- .../org/torproject/descriptor/index/DirectoryNode.java | 7 +++++++ .../java/org/torproject/descriptor/index/FileNode.java | 7 +++++++ .../java/org/torproject/descriptor/index/IndexNode.java | 8 ++++++++ 3 files changed, 22 insertions(+) diff --git a/src/main/java/org/torproject/descriptor/index/DirectoryNode.java b/src/main/java/org/torproject/descriptor/index/DirectoryNode.java index ad6dff8..562a6b4 100644 --- a/src/main/java/org/torproject/descriptor/index/DirectoryNode.java +++ b/src/main/java/org/torproject/descriptor/index/DirectoryNode.java @@ -26,6 +26,13 @@ public class DirectoryNode implements Comparable { @Expose public final SortedSet directories; + /* Added to satisfy Gson. */ + private DirectoryNode() { + path = null; + files = null; + directories = null; + } + /** A directory for the JSON structure. */ public DirectoryNode(String path, SortedSet files, SortedSet directories) { diff --git a/src/main/java/org/torproject/descriptor/index/FileNode.java b/src/main/java/org/torproject/descriptor/index/FileNode.java index 6af5aa3..ccbd261 100644 --- a/src/main/java/org/torproject/descriptor/index/FileNode.java +++ b/src/main/java/org/torproject/descriptor/index/FileNode.java @@ -39,6 +39,13 @@ public class FileNode implements Comparable { private long lastModifiedMillis; + /* Added to satisfy Gson. */ + private FileNode() { + path = null; + size = 0; + lastModified = null; + } + /** * A FileNode needs a path, i.e. the file name, the file size, and * the last modified date-time string. diff --git a/src/main/java/org/torproject/descriptor/index/IndexNode.java b/src/main/java/org/torproject/descriptor/index/IndexNode.java index b20ea06..bb83fb4 100644 --- a/src/main/java/org/torproject/descriptor/index/IndexNode.java +++ b/src/main/java/org/torproject/descriptor/index/IndexNode.java @@ -56,6 +56,14 @@ public class IndexNode { @Expose public final SortedSet files; + /* Added to satisfy Gson. */ + private IndexNode() { + created = null; + path = null; + files = null; + directories = null; + } + /** An index node is the top-level node in the JSON structure. */ public IndexNode(String created, String path, SortedSet files,