Skip to content

Commit ebc6f7a

Browse files
committed
spotbugs fixes
1 parent f16f6fa commit ebc6f7a

File tree

11 files changed

+23
-15
lines changed

11 files changed

+23
-15
lines changed

spotbugs/spotbugs-exclude.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,8 @@
2929
<Bug pattern="UWF_UNWRITTEN_FIELD"/>
3030
</Match>
3131

32+
<Match>
33+
<Class name="com.arangodb.internal.serde.InternalAnnotationIntrospector"/>
34+
</Match>
35+
3236
</FindBugsFilter>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ public Builder serializer(final ArangoSerde serialization) {
604604
*
605605
* @return {@link ArangoDB}
606606
*/
607-
public synchronized ArangoDB build() {
607+
public ArangoDB build() {
608608
if (hosts.isEmpty()) {
609609
hosts.add(host);
610610
}

src/main/java/com/arangodb/async/ArangoDBAsync.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ public Builder serializer(final ArangoSerde serialization) {
505505
*
506506
* @return {@link ArangoDBAsync}
507507
*/
508-
public synchronized ArangoDBAsync build() {
508+
public ArangoDBAsync build() {
509509
if (hosts.isEmpty()) {
510510
hosts.add(host);
511511
}

src/main/java/com/arangodb/internal/InternalArangoCollection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ protected Request getDocumentRequest(final String key, final DocumentReadOptions
161161
request.putHeaderParam(ArangoRequestParam.IF_NONE_MATCH, params.getIfNoneMatch());
162162
request.putHeaderParam(ArangoRequestParam.IF_MATCH, params.getIfMatch());
163163
request.putHeaderParam(TRANSACTION_ID, params.getStreamTransactionId());
164-
if (params.getAllowDirtyRead() == Boolean.TRUE) {
164+
if (Boolean.TRUE.equals(params.getAllowDirtyRead())) {
165165
RequestUtils.allowDirtyRead(request);
166166
}
167167
return request;
@@ -178,7 +178,7 @@ protected Request getDocumentsRequest(final Collection<String> keys, final Docum
178178
.putHeaderParam(ArangoRequestParam.IF_NONE_MATCH, params.getIfNoneMatch())
179179
.putHeaderParam(ArangoRequestParam.IF_MATCH, params.getIfMatch()).setBody(getSerde().serialize(keys))
180180
.putHeaderParam(TRANSACTION_ID, params.getStreamTransactionId());
181-
if (params.getAllowDirtyRead() == Boolean.TRUE) {
181+
if (Boolean.TRUE.equals(params.getAllowDirtyRead())) {
182182
RequestUtils.allowDirtyRead(request);
183183
}
184184
return request;

src/main/java/com/arangodb/internal/InternalArangoDBBuilder.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ public InternalArangoDBBuilder() {
9090
host = new HostDescription(ArangoDefaults.DEFAULT_HOST, ArangoDefaults.DEFAULT_PORT);
9191
hosts = new ArrayList<>();
9292
user = ArangoDefaults.DEFAULT_USER;
93-
loadProperties(ArangoDB.class.getResourceAsStream(DEFAULT_PROPERTY_FILE));
93+
try (InputStream is = ArangoDB.class.getResourceAsStream(DEFAULT_PROPERTY_FILE)) {
94+
loadProperties(is);
95+
} catch (IOException e) {
96+
throw new ArangoDBException(e);
97+
}
9498
}
9599

96100
private static void loadHosts(final Properties properties, final Collection<HostDescription> hosts) {

src/main/java/com/arangodb/internal/InternalArangoDatabase.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ protected Request queryRequest(final String query, final Map<String, Object> bin
147147
final AqlQueryOptions opt = options != null ? options : new AqlQueryOptions();
148148
final Request request = request(dbName, RequestType.POST, PATH_API_CURSOR)
149149
.setBody(getSerde().serialize(OptionsBuilder.build(opt, query, bindVars)));
150-
if (opt.getAllowDirtyRead() == Boolean.TRUE) {
150+
if (Boolean.TRUE.equals(opt.getAllowDirtyRead())) {
151151
RequestUtils.allowDirtyRead(request);
152152
}
153153
request.putHeaderParam(TRANSACTION_ID, opt.getStreamTransactionId());
@@ -164,7 +164,7 @@ protected Request queryNextRequest(final String id, final AqlQueryOptions option
164164

165165
final AqlQueryOptions opt = options != null ? options : new AqlQueryOptions();
166166

167-
if (opt.getAllowDirtyRead() == Boolean.TRUE) {
167+
if (Boolean.TRUE.equals(opt.getAllowDirtyRead())) {
168168
RequestUtils.allowDirtyRead(request);
169169
}
170170
request.putHeaderParam(TRANSACTION_ID, opt.getStreamTransactionId());
@@ -181,7 +181,7 @@ protected Request queryCloseRequest(final String id, final AqlQueryOptions optio
181181

182182
final AqlQueryOptions opt = options != null ? options : new AqlQueryOptions();
183183

184-
if (opt.getAllowDirtyRead() == Boolean.TRUE) {
184+
if (Boolean.TRUE.equals(opt.getAllowDirtyRead())) {
185185
RequestUtils.allowDirtyRead(request);
186186
}
187187
request.putHeaderParam(TRANSACTION_ID, opt.getStreamTransactionId());

src/main/java/com/arangodb/internal/InternalArangoEdgeCollection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ protected Request getEdgeRequest(final String key, final GraphDocumentReadOption
7777
request.putHeaderParam(TRANSACTION_ID, params.getStreamTransactionId());
7878
request.putHeaderParam(ArangoRequestParam.IF_NONE_MATCH, params.getIfNoneMatch());
7979
request.putHeaderParam(ArangoRequestParam.IF_MATCH, params.getIfMatch());
80-
if (params.getAllowDirtyRead() == Boolean.TRUE) {
80+
if (Boolean.TRUE.equals(params.getAllowDirtyRead())) {
8181
RequestUtils.allowDirtyRead(request);
8282
}
8383
return request;

src/main/java/com/arangodb/internal/InternalArangoVertexCollection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ protected Request getVertexRequest(final String key, final GraphDocumentReadOpti
8181
request.putHeaderParam(TRANSACTION_ID, params.getStreamTransactionId());
8282
request.putHeaderParam(ArangoRequestParam.IF_NONE_MATCH, params.getIfNoneMatch());
8383
request.putHeaderParam(ArangoRequestParam.IF_MATCH, params.getIfMatch());
84-
if (params.getAllowDirtyRead() == Boolean.TRUE) {
84+
if (Boolean.TRUE.equals(params.getAllowDirtyRead())) {
8585
RequestUtils.allowDirtyRead(request);
8686
}
8787
return request;

src/main/java/com/arangodb/internal/cursor/ArangoCursorImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public Collection<CursorWarning> getWarnings() {
9090
@Override
9191
public boolean isCached() {
9292
final Boolean cached = iterator.getResult().getCached();
93-
return Boolean.TRUE == cached;
93+
return Boolean.TRUE.equals(cached);
9494
}
9595

9696
@Override

src/main/java/com/arangodb/internal/http/HttpConnection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ private HttpConnection(final HostDescription host, final Integer timeout, final
9898
this.contentType = contentType;
9999
final RegistryBuilder<ConnectionSocketFactory> registryBuilder = RegistryBuilder
100100
.create();
101-
if (Boolean.TRUE == useSsl) {
101+
if (Boolean.TRUE.equals(useSsl)) {
102102
registryBuilder.register("https", new SSLConnectionSocketFactory(
103103
sslContext != null ? sslContext : SSLContexts.createSystemDefault(),
104104
hostnameVerifier != null ? hostnameVerifier : SSLConnectionSocketFactory.getDefaultHostnameVerifier()
@@ -226,7 +226,7 @@ private HttpRequestBase requestWithBody(final HttpEntityEnclosingRequestBase htt
226226
}
227227

228228
private String buildBaseUrl(final HostDescription host) {
229-
return (Boolean.TRUE == useSsl ? "https://" : "http://") + host.getHost() + ":" + host.getPort();
229+
return (Boolean.TRUE.equals(useSsl) ? "https://" : "http://") + host.getHost() + ":" + host.getPort();
230230
}
231231

232232
public Response execute(final Request request) throws IOException {

0 commit comments

Comments
 (0)