Skip to content

Commit 8d16192

Browse files
author
a-brandt
committed
fixed some sonarlint issues
1 parent c723d0d commit 8d16192

31 files changed

+941
-1008
lines changed

β€Žsrc/main/java/com/arangodb/BaseArangoDriver.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,4 +467,21 @@ protected String createIndexEndpointUrl(String database, Object... paths) throws
467467
protected String createGharialEndpointUrl(String database, Object... paths) throws ArangoException {
468468
return createEndpointUrl(database, "/_api/gharial", paths);
469469
}
470+
471+
protected String createDocumentEndpointUrl(String database, Object... paths) throws ArangoException {
472+
return createEndpointUrl(database, "/_api/document", paths);
473+
}
474+
475+
protected String createDatabaseEndpointUrl(String database, Object... paths) throws ArangoException {
476+
return createEndpointUrl(database, "/_api/database", paths);
477+
}
478+
479+
protected String createCursorEndpointUrl(String database, Object... paths) throws ArangoException {
480+
return createEndpointUrl(database, "/_api/cursor", paths);
481+
}
482+
483+
protected String createCollectionEndpointUrl(String database, Object... paths) throws ArangoException {
484+
return createEndpointUrl(database, "/_api/collection", paths);
485+
}
486+
470487
}

β€Žsrc/main/java/com/arangodb/ErrorNums.java

Lines changed: 276 additions & 274 deletions
Large diffs are not rendered by default.

β€Žsrc/main/java/com/arangodb/entity/AqlFunctionsEntity.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ public class AqlFunctionsEntity extends BaseEntity {
3131
*/
3232
Map<String, String> aqlFunctions;
3333

34-
public AqlFunctionsEntity() {
35-
}
36-
3734
AqlFunctionsEntity(Map<String, String> aqlfunctions) {
3835
this.aqlFunctions = aqlfunctions;
3936
}

β€Žsrc/main/java/com/arangodb/entity/BaseDocument.java

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -61,44 +61,6 @@ public BaseDocument(String documentKey) {
6161
this.documentKey = documentKey;
6262
}
6363

64-
// /**
65-
// * @param keyValues a set of key/value pairs containing the attributes for
66-
// the document.
67-
// * The length has to be even and each even entry has to be of type String.
68-
// * If not an empty document will be created
69-
// */
70-
// public BaseDocument(Object ...keyValues) {
71-
// this(null, keyValues);
72-
// }
73-
//
74-
// /**
75-
// * create a BaseDocument with a given key and attributes defined in
76-
// keyValues
77-
// *
78-
// * @param documentKey the unique key of the document
79-
// * @param keyValues a set of key/value pairs containing the attributes for
80-
// the document.
81-
// * The length has to be even and each even entry has to be of type String.
82-
// * If not an empty document will be created
83-
// */
84-
// public BaseDocument(String documentKey, Object ...keyValues) {
85-
// this.init();
86-
// if (documentKey != null) {
87-
// this.documentKey = documentKey;
88-
// }
89-
// if (checkKeyValues(keyValues)) {
90-
// for (int i = 0; i < keyValues.length; i = i+2) {
91-
// if (keyValues[i] == REV) {
92-
// this.documentRevision = (Long) keyValues[i+1];
93-
// } else if (keyValues[i] == KEY && documentKey == null) {
94-
// this.documentKey = (String) keyValues[i+1];
95-
// } else {
96-
// this.addAttribute((String) keyValues[i], keyValues[i + 1]);
97-
// }
98-
// }
99-
// }
100-
// }
101-
10264
/**
10365
* create an BaseDocument with given attributes
10466
*
@@ -221,23 +183,4 @@ public String toString() {
221183
+ ", documentKey=" + documentKey + ", properties=" + properties + "]";
222184
}
223185

224-
// /**
225-
// * check the list if it is suitable
226-
// *
227-
// * @param keyValues
228-
// * @return true, if the list has an even number and is an alternating
229-
// sequence of instances of String and Object.
230-
// */
231-
// private boolean checkKeyValues(Object... keyValues) {
232-
// if (keyValues.length %2 != 0) {
233-
// return false;
234-
// }
235-
// for (int i = 0; i < keyValues.length; i = i+2) {
236-
// if (! (keyValues[i] instanceof String)) {
237-
// return false;
238-
// }
239-
// }
240-
// return true;
241-
// }
242-
243186
}

β€Žsrc/main/java/com/arangodb/entity/BaseEntity.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public abstract class BaseEntity implements Serializable {
7474
* @return boolean
7575
*/
7676
public boolean isNotModified() {
77-
return statusCode == 304; // HttpStatus.SC_NOT_MODIFIED;
77+
return statusCode == 304;
7878
}
7979

8080
/**
@@ -86,15 +86,6 @@ public boolean isUnauthorized() {
8686
return statusCode == 401;
8787
}
8888

89-
// /**
90-
// * If the requested resource has not been modified it returns true
91-
// *
92-
// * @return boolean
93-
// */
94-
// public boolean isNotFound() {
95-
// return statusCode == 404;
96-
// }
97-
9889
/**
9990
* If this is the response of a batch request it returns true
10091
*

β€Žsrc/main/java/com/arangodb/entity/BaseMapEntity.java

Lines changed: 61 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -30,54 +30,66 @@
3030
*/
3131
public abstract class BaseMapEntity<K, V> extends BaseEntity implements Map<K, V> {
3232

33-
private final TreeMap<K, V> innerMap = new TreeMap<K, V>();
33+
private final TreeMap<K, V> innerMap = new TreeMap<K, V>();
34+
35+
@Override
36+
public int size() {
37+
return innerMap.size();
38+
}
39+
40+
@Override
41+
public boolean isEmpty() {
42+
return innerMap.isEmpty();
43+
}
44+
45+
@Override
46+
public boolean containsKey(Object key) {
47+
return innerMap.containsKey(key);
48+
}
49+
50+
@Override
51+
public boolean containsValue(Object value) {
52+
return innerMap.containsValue(value);
53+
}
54+
55+
@Override
56+
public V get(Object key) {
57+
return innerMap.get(key);
58+
}
59+
60+
@Override
61+
public V put(K key, V value) {
62+
return innerMap.put(key, value);
63+
}
64+
65+
@Override
66+
public V remove(Object key) {
67+
return innerMap.remove(key);
68+
}
69+
70+
@Override
71+
public void putAll(Map<? extends K, ? extends V> t) {
72+
innerMap.putAll(t);
73+
}
74+
75+
@Override
76+
public void clear() {
77+
innerMap.clear();
78+
}
79+
80+
@Override
81+
public Set<K> keySet() {
82+
return innerMap.keySet();
83+
}
84+
85+
@Override
86+
public Collection<V> values() {
87+
return innerMap.values();
88+
}
89+
90+
@Override
91+
public Set<java.util.Map.Entry<K, V>> entrySet() {
92+
return innerMap.entrySet();
93+
}
3494

35-
public int size() {
36-
return innerMap.size();
37-
}
38-
39-
public boolean isEmpty() {
40-
return innerMap.isEmpty();
41-
}
42-
43-
public boolean containsKey(Object key) {
44-
return innerMap.containsKey(key);
45-
}
46-
47-
public boolean containsValue(Object value) {
48-
return innerMap.containsValue(value);
49-
}
50-
51-
public V get(Object key) {
52-
return innerMap.get(key);
53-
}
54-
55-
public V put(K key, V value) {
56-
return innerMap.put(key, value);
57-
}
58-
59-
public V remove(Object key) {
60-
return innerMap.remove(key);
61-
}
62-
63-
public void putAll(Map<? extends K, ? extends V> t) {
64-
innerMap.putAll(t);
65-
}
66-
67-
public void clear() {
68-
innerMap.clear();
69-
}
70-
71-
public Set<K> keySet() {
72-
return innerMap.keySet();
73-
}
74-
75-
public Collection<V> values() {
76-
return innerMap.values();
77-
}
78-
79-
public Set<java.util.Map.Entry<K, V>> entrySet() {
80-
return innerMap.entrySet();
81-
}
82-
8395
}

β€Žsrc/main/java/com/arangodb/entity/BatchResponseEntity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ public class BatchResponseEntity extends BaseEntity {
3131
* The context of the function call, this is used to to process the server
3232
* response to an api entity.
3333
*/
34-
InvocationObject invocationObject;
34+
private InvocationObject invocationObject;
3535

3636
/**
3737
* The http response of the batch part.
3838
*/
39-
public HttpResponseEntity httpResponseEntity;
39+
private HttpResponseEntity httpResponseEntity;
4040

4141
public BatchResponseEntity(InvocationObject invocationObject) {
4242
this.invocationObject = invocationObject;

β€Žsrc/main/java/com/arangodb/entity/CollectionOptions.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ public class CollectionOptions {
6767
*/
6868
private List<String> shardKeys;
6969

70-
public CollectionOptions() {
71-
}
72-
7370
public Boolean getWaitForSync() {
7471
return waitForSync;
7572
}

β€Žsrc/main/java/com/arangodb/entity/CollectionStatus.java

Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -27,46 +27,54 @@
2727
*/
2828
public enum CollectionStatus {
2929

30-
/**
31-
* initial state of a new collection
32-
*/
33-
NEW_BORN_COLLECTION(1),
34-
35-
/**
36-
* collection is not in memory
37-
*/
38-
UNLOADED(2),
39-
40-
/**
41-
* collection is in memory
42-
*/
43-
LOADED(3),
44-
45-
/**
46-
* temporary state of a collection in the process of being unloaded
47-
*/
48-
IN_THE_PROCESS_OF_BEING_UNLOADED(4),
49-
50-
/**
51-
* deleted state
52-
*/
53-
DELETED(5)
54-
;
55-
56-
private static class Holder implements Serializable {
57-
private static final long serialVersionUID = -7016368432042468015L;
58-
private static TreeMap<Integer, CollectionStatus> lookupMap = new TreeMap<Integer, CollectionStatus>();
59-
}
60-
61-
private final int status;
62-
private CollectionStatus(int status) {
63-
this.status = status;
64-
Holder.lookupMap.put(status, this);
65-
}
66-
public int status() {
67-
return status;
68-
}
69-
public static CollectionStatus valueOf(int status) {
70-
return Holder.lookupMap.get(status);
71-
}
30+
/**
31+
* initial state of a new collection
32+
*/
33+
NEW_BORN_COLLECTION(1),
34+
35+
/**
36+
* collection is not in memory
37+
*/
38+
UNLOADED(2),
39+
40+
/**
41+
* collection is in memory
42+
*/
43+
LOADED(3),
44+
45+
/**
46+
* temporary state of a collection in the process of being unloaded
47+
*/
48+
IN_THE_PROCESS_OF_BEING_UNLOADED(4),
49+
50+
/**
51+
* deleted state
52+
*/
53+
DELETED(5);
54+
55+
private static class Holder implements Serializable {
56+
57+
private static final long serialVersionUID = -7016368432042468015L;
58+
59+
private static TreeMap<Integer, CollectionStatus> lookupMap = new TreeMap<Integer, CollectionStatus>();
60+
61+
private Holder() {
62+
// this is a helper class
63+
}
64+
}
65+
66+
private final int status;
67+
68+
private CollectionStatus(int status) {
69+
this.status = status;
70+
Holder.lookupMap.put(status, this);
71+
}
72+
73+
public int status() {
74+
return status;
75+
}
76+
77+
public static CollectionStatus valueOf(int status) {
78+
return Holder.lookupMap.get(status);
79+
}
7280
}

0 commit comments

Comments
 (0)