Skip to content

code analysis fixes #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/main/java/com/arangodb/ArangoCollection.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

package com.arangodb;

import java.util.Collection;

import com.arangodb.entity.*;
import com.arangodb.model.*;

import java.util.Collection;

/**
* Interface for operations on ArangoDB collection level.
*
Expand All @@ -34,21 +34,22 @@
* @see <a href="https://docs.arangodb.com/current/HTTP/Collection/">Collection API Documentation</a>
* @see <a href="https://docs.arangodb.com/current/HTTP/Collection/">Documents API Documentation</a>
*/
@SuppressWarnings("UnusedReturnValue")
public interface ArangoCollection extends ArangoSerializationAccessor {

/**
* The the handler of the database the collection is within
*
* @return database handler
*/
public ArangoDatabase db();
ArangoDatabase db();

/**
* The name of the collection
*
* @return collection name
*/
public String name();
String name();

/**
* Creates a new document from the given document, unless there is already a document with the _key given. If no
Expand Down
37 changes: 11 additions & 26 deletions src/main/java/com/arangodb/ArangoDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,14 @@

package com.arangodb;

import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.util.Collection;
import java.util.Properties;

import javax.net.ssl.SSLContext;

import com.arangodb.entity.*;
import com.arangodb.internal.ArangoContext;
import com.arangodb.internal.ArangoDBImpl;
import com.arangodb.internal.ArangoDefaults;
import com.arangodb.internal.InternalArangoDBBuilder;
import com.arangodb.internal.http.HttpCommunication;
import com.arangodb.internal.http.HttpConnectionFactory;
import com.arangodb.internal.net.ConnectionFactory;
import com.arangodb.internal.net.Host;
import com.arangodb.internal.net.HostHandle;
import com.arangodb.internal.net.HostHandler;
import com.arangodb.internal.net.HostResolver;
import com.arangodb.internal.net.*;
import com.arangodb.internal.util.ArangoDeserializerImpl;
import com.arangodb.internal.util.ArangoSerializationFactory;
import com.arangodb.internal.util.ArangoSerializerImpl;
Expand All @@ -52,21 +41,16 @@
import com.arangodb.util.ArangoDeserializer;
import com.arangodb.util.ArangoSerialization;
import com.arangodb.util.ArangoSerializer;
import com.arangodb.velocypack.VPack;
import com.arangodb.velocypack.VPackAnnotationFieldFilter;
import com.arangodb.velocypack.VPackAnnotationFieldNaming;
import com.arangodb.velocypack.VPackDeserializer;
import com.arangodb.velocypack.VPackInstanceCreator;
import com.arangodb.velocypack.VPackJsonDeserializer;
import com.arangodb.velocypack.VPackJsonSerializer;
import com.arangodb.velocypack.VPackModule;
import com.arangodb.velocypack.VPackParser;
import com.arangodb.velocypack.VPackParserModule;
import com.arangodb.velocypack.VPackSerializer;
import com.arangodb.velocypack.ValueType;
import com.arangodb.velocypack.*;
import com.arangodb.velocystream.Request;
import com.arangodb.velocystream.Response;

import javax.net.ssl.SSLContext;
import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.util.Collection;
import java.util.Properties;

/**
* Central access point for applications to communicate with an ArangoDB server.
*
Expand All @@ -82,16 +66,17 @@
* @author Mark Vollmary
* @author Michele Rastelli
*/
@SuppressWarnings("UnusedReturnValue")
public interface ArangoDB extends ArangoSerializationAccessor {

/**
* Builder class to build an instance of {@link ArangoDB}.
*
* @author Mark Vollmary
*/
public static class Builder extends InternalArangoDBBuilder {
class Builder extends InternalArangoDBBuilder {

private static String PROPERTY_KEY_PROTOCOL = "arangodb.protocol";
private static final String PROPERTY_KEY_PROTOCOL = "arangodb.protocol";

protected Protocol protocol;

Expand Down
9 changes: 5 additions & 4 deletions src/main/java/com/arangodb/ArangoDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

package com.arangodb;

import java.util.Collection;
import java.util.Map;

import com.arangodb.entity.*;
import com.arangodb.model.*;
import com.arangodb.entity.arangosearch.AnalyzerEntity;
import com.arangodb.model.*;
import com.arangodb.model.arangosearch.AnalyzerDeleteOptions;
import com.arangodb.model.arangosearch.ArangoSearchCreateOptions;

import java.util.Collection;
import java.util.Map;

/**
* Interface for operations on ArangoDB database level.
*
Expand All @@ -37,6 +37,7 @@
* @see <a href="https://docs.arangodb.com/current/HTTP/Database/">Databases API Documentation</a>
* @see <a href="https://docs.arangodb.com/current/HTTP/AqlQuery/">Query API Documentation</a>
*/
@SuppressWarnings("UnusedReturnValue")
public interface ArangoDatabase extends ArangoSerializationAccessor {

/**
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/arangodb/ArangoEdgeCollection.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* @see <a href="https://docs.arangodb.com/current/HTTP/Gharial/Edges.html">API Documentation</a>
* @author Mark Vollmary
*/
@SuppressWarnings("UnusedReturnValue")
public interface ArangoEdgeCollection extends ArangoSerializationAccessor {

/**
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/arangodb/ArangoView.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @author Mark Vollmary
* @since ArangoDB 3.4.0
*/
@SuppressWarnings("UnusedReturnValue")
public interface ArangoView extends ArangoSerializationAccessor {

/**
Expand Down
35 changes: 14 additions & 21 deletions src/main/java/com/arangodb/entity/BaseDocument.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@

package com.arangodb.entity;

import com.arangodb.entity.DocumentField.Type;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import com.arangodb.entity.DocumentField.Type;

/**
* @author Mark Vollmary
*
Expand All @@ -44,7 +44,7 @@ public class BaseDocument implements Serializable {

public BaseDocument() {
super();
properties = new HashMap<String, Object>();
properties = new HashMap<>();
}

public BaseDocument(final String key) {
Expand Down Expand Up @@ -117,17 +117,15 @@ public Object getAttribute(final String key) {

@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("BaseDocument [documentRevision=");
sb.append(revision);
sb.append(", documentHandle=");
sb.append(id);
sb.append(", documentKey=");
sb.append(key);
sb.append(", properties=");
sb.append(properties);
sb.append("]");
return sb.toString();
return "BaseDocument [documentRevision=" +
revision +
", documentHandle=" +
id +
", documentKey=" +
key +
", properties=" +
properties +
"]";
}

@Override
Expand Down Expand Up @@ -175,13 +173,8 @@ public boolean equals(final Object obj) {
return false;
}
if (revision == null) {
if (other.revision != null) {
return false;
}
} else if (!revision.equals(other.revision)) {
return false;
}
return true;
return other.revision == null;
} else return revision.equals(other.revision);
}

}
41 changes: 17 additions & 24 deletions src/main/java/com/arangodb/entity/BaseEdgeDocument.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

package com.arangodb.entity;

import java.util.Map;

import com.arangodb.entity.DocumentField.Type;

import java.util.Map;

/**
* @author Mark Vollmary
*
Expand Down Expand Up @@ -83,21 +83,19 @@ public void setTo(final String to) {

@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("BaseDocument [documentRevision=");
sb.append(revision);
sb.append(", documentHandle=");
sb.append(id);
sb.append(", documentKey=");
sb.append(key);
sb.append(", from=");
sb.append(from);
sb.append(", to=");
sb.append(to);
sb.append(", properties=");
sb.append(properties);
sb.append("]");
return sb.toString();
return "BaseDocument [documentRevision=" +
revision +
", documentHandle=" +
id +
", documentKey=" +
key +
", from=" +
from +
", to=" +
to +
", properties=" +
properties +
"]";
}

@Override
Expand Down Expand Up @@ -129,13 +127,8 @@ public boolean equals(final Object obj) {
return false;
}
if (to == null) {
if (other.to != null) {
return false;
}
} else if (!to.equals(other.to)) {
return false;
}
return true;
return other.to == null;
} else return to.equals(other.to);
}

}
4 changes: 2 additions & 2 deletions src/main/java/com/arangodb/entity/DocumentField.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
@Target({ ElementType.FIELD })
public @interface DocumentField {

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

private final String serializeName;

private Type(final String serializeName) {
Type(final String serializeName) {
this.serializeName = serializeName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class DocumentImportEntity implements Entity {

public DocumentImportEntity() {
super();
details = new ArrayList<String>();
details = new ArrayList<>();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/arangodb/entity/LogLevelEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
public class LogLevelEntity implements Entity {

public enum LogLevel {
FATAL, ERROR, WARNING, INFO, DEBUG, TRACE, DEFAULT;
FATAL, ERROR, WARNING, INFO, DEBUG, TRACE, DEFAULT
}

private LogLevel agency;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/arangodb/entity/MetaAware.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
*/
public interface MetaAware {

public Map<String, String> getMeta();
Map<String, String> getMeta();

public void setMeta(final Map<String, String> meta);
void setMeta(final Map<String, String> meta);

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
public class QueryCachePropertiesEntity implements Entity {

public enum CacheMode {
off, on, demand;
off, on, demand
}

private CacheMode mode;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/arangodb/entity/ShardingStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public enum ShardingStrategy {
ENTERPRISE_SMART_EDGE_COMPAT("enterprise-smart-edge-compat"),
HASH("hash"),
ENTERPRISE_HASH_SMART_EDGE("enterprise-hash-smart-edge");
private String internalName;
private ShardingStrategy(String internalName) {

private final String internalName;

ShardingStrategy(String internalName) {
this.internalName = internalName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public class ArangoSearchProperties {

public ArangoSearchProperties() {
super();
links = new ArrayList<CollectionLink>();
primarySorts = new ArrayList<PrimarySort>();
links = new ArrayList<>();
primarySorts = new ArrayList<>();
}

public Long getCommitIntervalMsec() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public class CollectionLink {
private CollectionLink(final String name) {
super();
this.name = name;
fields = new ArrayList<FieldLink>();
analyzers = new ArrayList<String>();
fields = new ArrayList<>();
analyzers = new ArrayList<>();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/arangodb/entity/arangosearch/FieldLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class FieldLink {
private FieldLink(final String name) {
super();
this.name = name;
fields = new ArrayList<FieldLink>();
analyzers = new ArrayList<String>();
fields = new ArrayList<>();
analyzers = new ArrayList<>();
}

/**
Expand Down
Loading