[tor-commits] [metrics-lib/master] Make tests pass again. Gson demands no-args constructors.
karsten at torproject.org
karsten at torproject.org
Thu Jan 5 14:36:18 UTC 2017
commit fa2d2275271decaf81196537ab4fe98ab1ce939e
Author: iwakeh <iwakeh at torproject.org>
Date: Mon Dec 26 13:11:34 2016 +0100
Make tests pass again. Gson demands no-args constructors.
---
src/main/java/org/torproject/descriptor/index/DirectoryNode.java | 7 +++++++
src/main/java/org/torproject/descriptor/index/FileNode.java | 7 +++++++
src/main/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<DirectoryNode> {
@Expose
public final SortedSet<DirectoryNode> directories;
+ /* Added to satisfy Gson. */
+ private DirectoryNode() {
+ path = null;
+ files = null;
+ directories = null;
+ }
+
/** A directory for the JSON structure. */
public DirectoryNode(String path, SortedSet<FileNode> files,
SortedSet<DirectoryNode> 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<FileNode> {
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<FileNode> 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<FileNode> files,
More information about the tor-commits
mailing list