• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

knowledgepixels / nanodash / 23133101585

16 Mar 2026 07:45AM UTC coverage: 15.984% (+0.2%) from 15.811%
23133101585

Pull #402

github

web-flow
Merge bd8288c47 into 39c6ac11c
Pull Request #402: Fix unbounded memory growth and resource exhaustion

717 of 5509 branches covered (13.02%)

Branch coverage included in aggregate %.

1809 of 10294 relevant lines covered (17.57%)

2.39 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

60.0
src/main/java/com/knowledgepixels/nanodash/RegistryAccountInfo.java
1
package com.knowledgepixels.nanodash;
2

3
import com.github.jsonldjava.shaded.com.google.common.reflect.TypeToken;
4
import com.google.gson.Gson;
5
import com.google.gson.JsonIOException;
6
import com.google.gson.JsonSyntaxException;
7
import org.eclipse.rdf4j.model.IRI;
8
import org.eclipse.rdf4j.model.util.Values;
9

10
import java.io.IOException;
11
import java.io.InputStreamReader;
12
import java.lang.reflect.Type;
13
import java.net.URI;
14
import java.net.URISyntaxException;
15
import java.util.ArrayList;
16
import java.util.List;
17

18
/**
19
 * This class is used to access registry account lists of Nanopub Registry instances.
20
 */
21
public class RegistryAccountInfo {
9✔
22

23
    private static Gson g = new Gson();
12✔
24
    private static Type listType = new TypeToken<ArrayList<RegistryAccountInfo>>() {
21✔
25
    }.getType();
6✔
26

27
    /**
28
     * Fetches and parses a list of registry accounts from the given URL.
29
     *
30
     * @param url e.g. "<a href="https://registry.knowledgepixels.com/list.json">https://registry.knowledgepixels.com/list.json</a>"
31
     * @return List of RegistryAccountInfo objects
32
     * @throws JsonIOException     if there is a problem reading from the URL
33
     * @throws JsonSyntaxException if the JSON is not in the expected format
34
     * @throws IOException         if there is a problem with the network connection
35
     * @throws URISyntaxException  if the URL is not valid
36
     */
37
    public static List<RegistryAccountInfo> fromUrl(String url) throws JsonIOException, JsonSyntaxException, IOException, URISyntaxException {
38
        try (InputStreamReader reader = new InputStreamReader(new URI(url).toURL().openStream())) {
30✔
39
            return g.fromJson(reader, listType);
24✔
40
        }
41
    }
42

43
    private String agent;
44
    private String pubkey;
45
    private String status;
46
    private int depth;
47
    private int pathCount;
48
    private long quota;
49
    private double ratio;
50

51
    /**
52
     * Returns the Type object representing a list of RegistryAccountInfo objects.
53
     *
54
     * @return Type object
55
     */
56
    public static Type getListType() {
57
        return listType;
×
58
    }
59

60
    /**
61
     * Returns the agent URI as a string.
62
     *
63
     * @return Agent URI string
64
     */
65
    public String getAgent() {
66
        return agent;
9✔
67
    }
68

69
    /**
70
     * Returns the agent URI as an IRI object.
71
     *
72
     * @return Agent IRI
73
     */
74
    public IRI getAgentIri() {
75
        return Values.iri(agent);
12✔
76
    }
77

78
    /**
79
     * Returns the public key associated with the account.
80
     *
81
     * @return Public key string
82
     */
83
    public String getPubkey() {
84
        return pubkey;
9✔
85
    }
86

87
    /**
88
     * Returns the status of the account.
89
     *
90
     * @return Status string
91
     */
92
    public String getStatus() {
93
        return status;
×
94
    }
95

96
    /**
97
     * Returns the depth of the account.
98
     *
99
     * @return Depth integer
100
     */
101
    public int getDepth() {
102
        return depth;
×
103
    }
104

105
    /**
106
     * Returns the path count of the account.
107
     *
108
     * @return Path count integer
109
     */
110
    public int getPathCount() {
111
        return pathCount;
×
112
    }
113

114
    /**
115
     * Returns the quota of the account.
116
     *
117
     * @return Quota long
118
     */
119
    public long getQuota() {
120
        return quota;
×
121
    }
122

123
    /**
124
     * Returns the ratio of the account.
125
     *
126
     * @return Ratio double
127
     */
128
    public double getRatio() {
129
        return ratio;
×
130
    }
131

132
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc