Skip to content

Commit e3dbb28

Browse files
committed
Fix hygiene - findbugs
Signed-off-by: Aditya Sirish <[email protected]>
1 parent 2690d4a commit e3dbb28

File tree

2 files changed

+35
-24
lines changed

2 files changed

+35
-24
lines changed

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@
6464
<artifactId>google-http-client</artifactId>
6565
<version>1.23.0</version>
6666
</dependency>
67-
<dependency>
67+
<!--<dependency>
6868
<groupId>com.google.code.gson</groupId>
6969
<artifactId>gson</artifactId>
7070
<version>2.8.5</version>
71-
</dependency>
71+
</dependency>-->
7272

7373
<!--
7474
FIXME: this apparently requires a version of Guava that conflicts w

src/main/java/io/jenkins/plugins/intotorecorder/transport/GrafeasTransport.java

+33-22
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,40 @@ public class GrafeasTransport extends Transport {
2626
URI uri;
2727
GrafeasOccurrence occurrence;
2828

29-
public class GrafeasInTotoMetadata {
29+
public static class GrafeasInTotoMetadata {
3030
// This class exists to represent the signed document format for Grafeas
3131
// in-toto links.
3232

33-
public ArrayList<Signature> signatures = new ArrayList<Signature>();
34-
public GrafeasInTotoLink signed;
33+
@edu.umd.cs.findbugs.annotations.SuppressWarnings("URF_UNREAD_FIELD")
34+
private ArrayList<Signature> signatures = new ArrayList<Signature>();
35+
@edu.umd.cs.findbugs.annotations.SuppressWarnings("URF_UNREAD_FIELD")
36+
private GrafeasInTotoLink signed;
3537

36-
private class GrafeasInTotoLink {
38+
private static class GrafeasInTotoLink {
3739
// This class exists to represent the Grafeas document format for
3840
// in-toto links.
3941

40-
private class Artifact {
41-
public String resourceUri;
42-
public Map<String, String> hashes;
42+
private static class Artifact {
43+
@edu.umd.cs.findbugs.annotations.SuppressWarnings("URF_UNREAD_FIELD")
44+
private String resourceUri;
45+
@edu.umd.cs.findbugs.annotations.SuppressWarnings("URF_UNREAD_FIELD")
46+
private Map<String, String> hashes;
4347

44-
public Artifact(String resourceUri, Map<String, String> hashes) {
48+
private Artifact(String resourceUri, Map<String, String> hashes) {
4549
this.resourceUri = resourceUri;
4650
this.hashes = hashes;
4751
}
4852

4953
}
5054

51-
public List<String> command = new ArrayList<String>();
52-
public List<Artifact> materials = new ArrayList<Artifact>();
53-
public List<Artifact> products = new ArrayList<Artifact>();
54-
public Map<String, Map<String, String>> byproducts = new HashMap<String, Map<String, String>>();
55-
public Map<String, Map<String, String>> environment = new HashMap<String, Map<String, String>>();
55+
@edu.umd.cs.findbugs.annotations.SuppressWarnings("URF_UNREAD_FIELD")
56+
private List<String> command = new ArrayList<String>();
57+
@edu.umd.cs.findbugs.annotations.SuppressWarnings("URF_UNREAD_FIELD")
58+
private List<Artifact> materials = new ArrayList<Artifact>();
59+
@edu.umd.cs.findbugs.annotations.SuppressWarnings("URF_UNREAD_FIELD")
60+
private List<Artifact> products = new ArrayList<Artifact>();
61+
private Map<String, Map<String, String>> byproducts = new HashMap<String, Map<String, String>>();
62+
private Map<String, Map<String, String>> environment = new HashMap<String, Map<String, String>>();
5663

5764
public GrafeasInTotoLink(List<String> command,
5865
Map<String, ArtifactHash> materials,
@@ -75,13 +82,13 @@ public GrafeasInTotoLink(List<String> command,
7582
}
7683

7784
Map<String, String> stringByproducts = new HashMap<String, String>();
78-
for (String byproduct : byproducts.keySet()) {
79-
stringByproducts.put(byproduct, String.valueOf(byproducts.get(byproduct)));
85+
for (Map.Entry<String, Object> entry : byproducts.entrySet()) {
86+
stringByproducts.put(entry.getKey(), String.valueOf(entry.getValue()));
8087
}
8188

8289
Map<String, String> stringEnvironment = new HashMap<String, String>();
83-
for (String env : environment.keySet()) {
84-
stringEnvironment.put(env, String.valueOf(environment.get(env)));
90+
for (Map.Entry<String, Object> entry : environment.entrySet()) {
91+
stringEnvironment.put(entry.getKey(), String.valueOf(entry.getValue()));
8592
}
8693

8794
this.byproducts.put("customValues", stringByproducts);
@@ -102,11 +109,14 @@ public GrafeasInTotoMetadata(Link link) {
102109
}
103110

104111

105-
public class GrafeasOccurrence {
106-
public String noteName;
107-
public Map<String, String> resource = new HashMap<String, String>();
108-
public String kind = "INTOTO";
109-
public GrafeasInTotoMetadata intoto;
112+
public static class GrafeasOccurrence {
113+
@edu.umd.cs.findbugs.annotations.SuppressWarnings("URF_UNREAD_FIELD")
114+
private String noteName;
115+
private Map<String, String> resource = new HashMap<String, String>();
116+
@edu.umd.cs.findbugs.annotations.SuppressWarnings("URF_UNREAD_FIELD")
117+
private String kind = "INTOTO";
118+
@edu.umd.cs.findbugs.annotations.SuppressWarnings("URF_UNREAD_FIELD")
119+
private GrafeasInTotoMetadata intoto;
110120

111121
public GrafeasOccurrence(String noteName, String resourceUri) {
112122
this.noteName = noteName;
@@ -144,6 +154,7 @@ public GrafeasTransport(URI uri) {
144154

145155
Map<String, String> parameterMap = GrafeasTransport.getParameterMap(parameterString);
146156

157+
@edu.umd.cs.findbugs.annotations.SuppressWarnings("URF_UNREAD_FIELD")
147158
GrafeasOccurrence occurrence = new GrafeasOccurrence(
148159
parameterMap.get("noteName"),
149160
parameterMap.get("resourceUri")

0 commit comments

Comments
 (0)