Skip to content

Commit 73b2805

Browse files
authored
code analysis fixes (#312)
1 parent d89b9f8 commit 73b2805

File tree

71 files changed

+1073
-1713
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1073
-1713
lines changed

src/main/java/com/arangodb/ArangoCollection.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020

2121
package com.arangodb;
2222

23-
import java.util.Collection;
24-
2523
import com.arangodb.entity.*;
2624
import com.arangodb.model.*;
2725

26+
import java.util.Collection;
27+
2828
/**
2929
* Interface for operations on ArangoDB collection level.
3030
*
@@ -34,21 +34,22 @@
3434
* @see <a href="https://docs.arangodb.com/current/HTTP/Collection/">Collection API Documentation</a>
3535
* @see <a href="https://docs.arangodb.com/current/HTTP/Collection/">Documents API Documentation</a>
3636
*/
37+
@SuppressWarnings("UnusedReturnValue")
3738
public interface ArangoCollection extends ArangoSerializationAccessor {
3839

3940
/**
4041
* The the handler of the database the collection is within
4142
*
4243
* @return database handler
4344
*/
44-
public ArangoDatabase db();
45+
ArangoDatabase db();
4546

4647
/**
4748
* The name of the collection
4849
*
4950
* @return collection name
5051
*/
51-
public String name();
52+
String name();
5253

5354
/**
5455
* Creates a new document from the given document, unless there is already a document with the _key given. If no

src/main/java/com/arangodb/ArangoDB.java

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,14 @@
2020

2121
package com.arangodb;
2222

23-
import java.io.InputStream;
24-
import java.lang.annotation.Annotation;
25-
import java.util.Collection;
26-
import java.util.Properties;
27-
28-
import javax.net.ssl.SSLContext;
29-
3023
import com.arangodb.entity.*;
3124
import com.arangodb.internal.ArangoContext;
3225
import com.arangodb.internal.ArangoDBImpl;
3326
import com.arangodb.internal.ArangoDefaults;
3427
import com.arangodb.internal.InternalArangoDBBuilder;
3528
import com.arangodb.internal.http.HttpCommunication;
3629
import com.arangodb.internal.http.HttpConnectionFactory;
37-
import com.arangodb.internal.net.ConnectionFactory;
38-
import com.arangodb.internal.net.Host;
39-
import com.arangodb.internal.net.HostHandle;
40-
import com.arangodb.internal.net.HostHandler;
41-
import com.arangodb.internal.net.HostResolver;
30+
import com.arangodb.internal.net.*;
4231
import com.arangodb.internal.util.ArangoDeserializerImpl;
4332
import com.arangodb.internal.util.ArangoSerializationFactory;
4433
import com.arangodb.internal.util.ArangoSerializerImpl;
@@ -52,21 +41,16 @@
5241
import com.arangodb.util.ArangoDeserializer;
5342
import com.arangodb.util.ArangoSerialization;
5443
import com.arangodb.util.ArangoSerializer;
55-
import com.arangodb.velocypack.VPack;
56-
import com.arangodb.velocypack.VPackAnnotationFieldFilter;
57-
import com.arangodb.velocypack.VPackAnnotationFieldNaming;
58-
import com.arangodb.velocypack.VPackDeserializer;
59-
import com.arangodb.velocypack.VPackInstanceCreator;
60-
import com.arangodb.velocypack.VPackJsonDeserializer;
61-
import com.arangodb.velocypack.VPackJsonSerializer;
62-
import com.arangodb.velocypack.VPackModule;
63-
import com.arangodb.velocypack.VPackParser;
64-
import com.arangodb.velocypack.VPackParserModule;
65-
import com.arangodb.velocypack.VPackSerializer;
66-
import com.arangodb.velocypack.ValueType;
44+
import com.arangodb.velocypack.*;
6745
import com.arangodb.velocystream.Request;
6846
import com.arangodb.velocystream.Response;
6947

48+
import javax.net.ssl.SSLContext;
49+
import java.io.InputStream;
50+
import java.lang.annotation.Annotation;
51+
import java.util.Collection;
52+
import java.util.Properties;
53+
7054
/**
7155
* Central access point for applications to communicate with an ArangoDB server.
7256
*
@@ -82,16 +66,17 @@
8266
* @author Mark Vollmary
8367
* @author Michele Rastelli
8468
*/
69+
@SuppressWarnings("UnusedReturnValue")
8570
public interface ArangoDB extends ArangoSerializationAccessor {
8671

8772
/**
8873
* Builder class to build an instance of {@link ArangoDB}.
8974
*
9075
* @author Mark Vollmary
9176
*/
92-
public static class Builder extends InternalArangoDBBuilder {
77+
class Builder extends InternalArangoDBBuilder {
9378

94-
private static String PROPERTY_KEY_PROTOCOL = "arangodb.protocol";
79+
private static final String PROPERTY_KEY_PROTOCOL = "arangodb.protocol";
9580

9681
protected Protocol protocol;
9782

src/main/java/com/arangodb/ArangoDatabase.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020

2121
package com.arangodb;
2222

23-
import java.util.Collection;
24-
import java.util.Map;
25-
2623
import com.arangodb.entity.*;
27-
import com.arangodb.model.*;
2824
import com.arangodb.entity.arangosearch.AnalyzerEntity;
25+
import com.arangodb.model.*;
2926
import com.arangodb.model.arangosearch.AnalyzerDeleteOptions;
3027
import com.arangodb.model.arangosearch.ArangoSearchCreateOptions;
3128

29+
import java.util.Collection;
30+
import java.util.Map;
31+
3232
/**
3333
* Interface for operations on ArangoDB database level.
3434
*
@@ -37,6 +37,7 @@
3737
* @see <a href="https://docs.arangodb.com/current/HTTP/Database/">Databases API Documentation</a>
3838
* @see <a href="https://docs.arangodb.com/current/HTTP/AqlQuery/">Query API Documentation</a>
3939
*/
40+
@SuppressWarnings("UnusedReturnValue")
4041
public interface ArangoDatabase extends ArangoSerializationAccessor {
4142

4243
/**

src/main/java/com/arangodb/ArangoEdgeCollection.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* @see <a href="https://docs.arangodb.com/current/HTTP/Gharial/Edges.html">API Documentation</a>
3131
* @author Mark Vollmary
3232
*/
33+
@SuppressWarnings("UnusedReturnValue")
3334
public interface ArangoEdgeCollection extends ArangoSerializationAccessor {
3435

3536
/**

src/main/java/com/arangodb/ArangoView.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
* @author Mark Vollmary
3030
* @since ArangoDB 3.4.0
3131
*/
32+
@SuppressWarnings("UnusedReturnValue")
3233
public interface ArangoView extends ArangoSerializationAccessor {
3334

3435
/**

src/main/java/com/arangodb/entity/BaseDocument.java

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020

2121
package com.arangodb.entity;
2222

23+
import com.arangodb.entity.DocumentField.Type;
24+
2325
import java.io.Serializable;
2426
import java.util.HashMap;
2527
import java.util.Map;
2628

27-
import com.arangodb.entity.DocumentField.Type;
28-
2929
/**
3030
* @author Mark Vollmary
3131
*
@@ -44,7 +44,7 @@ public class BaseDocument implements Serializable {
4444

4545
public BaseDocument() {
4646
super();
47-
properties = new HashMap<String, Object>();
47+
properties = new HashMap<>();
4848
}
4949

5050
public BaseDocument(final String key) {
@@ -117,17 +117,15 @@ public Object getAttribute(final String key) {
117117

118118
@Override
119119
public String toString() {
120-
final StringBuilder sb = new StringBuilder();
121-
sb.append("BaseDocument [documentRevision=");
122-
sb.append(revision);
123-
sb.append(", documentHandle=");
124-
sb.append(id);
125-
sb.append(", documentKey=");
126-
sb.append(key);
127-
sb.append(", properties=");
128-
sb.append(properties);
129-
sb.append("]");
130-
return sb.toString();
120+
return "BaseDocument [documentRevision=" +
121+
revision +
122+
", documentHandle=" +
123+
id +
124+
", documentKey=" +
125+
key +
126+
", properties=" +
127+
properties +
128+
"]";
131129
}
132130

133131
@Override
@@ -175,13 +173,8 @@ public boolean equals(final Object obj) {
175173
return false;
176174
}
177175
if (revision == null) {
178-
if (other.revision != null) {
179-
return false;
180-
}
181-
} else if (!revision.equals(other.revision)) {
182-
return false;
183-
}
184-
return true;
176+
return other.revision == null;
177+
} else return revision.equals(other.revision);
185178
}
186179

187180
}

src/main/java/com/arangodb/entity/BaseEdgeDocument.java

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
package com.arangodb.entity;
2222

23-
import java.util.Map;
24-
2523
import com.arangodb.entity.DocumentField.Type;
2624

25+
import java.util.Map;
26+
2727
/**
2828
* @author Mark Vollmary
2929
*
@@ -83,21 +83,19 @@ public void setTo(final String to) {
8383

8484
@Override
8585
public String toString() {
86-
final StringBuilder sb = new StringBuilder();
87-
sb.append("BaseDocument [documentRevision=");
88-
sb.append(revision);
89-
sb.append(", documentHandle=");
90-
sb.append(id);
91-
sb.append(", documentKey=");
92-
sb.append(key);
93-
sb.append(", from=");
94-
sb.append(from);
95-
sb.append(", to=");
96-
sb.append(to);
97-
sb.append(", properties=");
98-
sb.append(properties);
99-
sb.append("]");
100-
return sb.toString();
86+
return "BaseDocument [documentRevision=" +
87+
revision +
88+
", documentHandle=" +
89+
id +
90+
", documentKey=" +
91+
key +
92+
", from=" +
93+
from +
94+
", to=" +
95+
to +
96+
", properties=" +
97+
properties +
98+
"]";
10199
}
102100

103101
@Override
@@ -129,13 +127,8 @@ public boolean equals(final Object obj) {
129127
return false;
130128
}
131129
if (to == null) {
132-
if (other.to != null) {
133-
return false;
134-
}
135-
} else if (!to.equals(other.to)) {
136-
return false;
137-
}
138-
return true;
130+
return other.to == null;
131+
} else return to.equals(other.to);
139132
}
140133

141134
}

src/main/java/com/arangodb/entity/DocumentField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
@Target({ ElementType.FIELD })
3434
public @interface DocumentField {
3535

36-
public static enum Type {
36+
enum Type {
3737
ID("_id"), KEY("_key"), REV("_rev"), FROM("_from"), TO("_to");
3838

3939
private final String serializeName;
4040

41-
private Type(final String serializeName) {
41+
Type(final String serializeName) {
4242
this.serializeName = serializeName;
4343
}
4444

src/main/java/com/arangodb/entity/DocumentImportEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class DocumentImportEntity implements Entity {
3838

3939
public DocumentImportEntity() {
4040
super();
41-
details = new ArrayList<String>();
41+
details = new ArrayList<>();
4242
}
4343

4444
/**

src/main/java/com/arangodb/entity/LogLevelEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
public class LogLevelEntity implements Entity {
2828

2929
public enum LogLevel {
30-
FATAL, ERROR, WARNING, INFO, DEBUG, TRACE, DEFAULT;
30+
FATAL, ERROR, WARNING, INFO, DEBUG, TRACE, DEFAULT
3131
}
3232

3333
private LogLevel agency;

src/main/java/com/arangodb/entity/MetaAware.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
*/
99
public interface MetaAware {
1010

11-
public Map<String, String> getMeta();
11+
Map<String, String> getMeta();
1212

13-
public void setMeta(final Map<String, String> meta);
13+
void setMeta(final Map<String, String> meta);
1414

1515
}

src/main/java/com/arangodb/entity/QueryCachePropertiesEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
public class QueryCachePropertiesEntity implements Entity {
3131

3232
public enum CacheMode {
33-
off, on, demand;
33+
off, on, demand
3434
}
3535

3636
private CacheMode mode;

src/main/java/com/arangodb/entity/ShardingStrategy.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ public enum ShardingStrategy {
3131
ENTERPRISE_SMART_EDGE_COMPAT("enterprise-smart-edge-compat"),
3232
HASH("hash"),
3333
ENTERPRISE_HASH_SMART_EDGE("enterprise-hash-smart-edge");
34-
35-
private String internalName;
36-
37-
private ShardingStrategy(String internalName) {
34+
35+
private final String internalName;
36+
37+
ShardingStrategy(String internalName) {
3838
this.internalName = internalName;
3939
}
4040

src/main/java/com/arangodb/entity/arangosearch/ArangoSearchProperties.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public class ArangoSearchProperties {
4040

4141
public ArangoSearchProperties() {
4242
super();
43-
links = new ArrayList<CollectionLink>();
44-
primarySorts = new ArrayList<PrimarySort>();
43+
links = new ArrayList<>();
44+
primarySorts = new ArrayList<>();
4545
}
4646

4747
public Long getCommitIntervalMsec() {

src/main/java/com/arangodb/entity/arangosearch/CollectionLink.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public class CollectionLink {
4040
private CollectionLink(final String name) {
4141
super();
4242
this.name = name;
43-
fields = new ArrayList<FieldLink>();
44-
analyzers = new ArrayList<String>();
43+
fields = new ArrayList<>();
44+
analyzers = new ArrayList<>();
4545
}
4646

4747
/**

src/main/java/com/arangodb/entity/arangosearch/FieldLink.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public class FieldLink {
1616
private FieldLink(final String name) {
1717
super();
1818
this.name = name;
19-
fields = new ArrayList<FieldLink>();
20-
analyzers = new ArrayList<String>();
19+
fields = new ArrayList<>();
20+
analyzers = new ArrayList<>();
2121
}
2222

2323
/**

0 commit comments

Comments
 (0)