From 06fed5041b92382f7c89dbc820163ee507fb3d7b Mon Sep 17 00:00:00 2001 From: Axel Becker Date: Wed, 30 Jan 2019 21:18:50 +0100 Subject: [PATCH 1/5] update to java 8 --- pom.xml | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 4a2f21f40..72236aa01 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ 1.4.1 - 4.5.1 + 4.5.7 1.1.3 @@ -74,10 +74,34 @@ + + + true + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M2 + + + enforce-maven-3 + + enforce + + + + + 3.0.5 + + + true + + + + + org.sonatype.plugins nexus-staging-maven-plugin - 1.6.5 + 1.6.8 true ossrh @@ -90,7 +114,6 @@ org.apache.maven.plugins maven-assembly-plugin - 2.4.1 assembly @@ -115,10 +138,9 @@ org.apache.maven.plugins maven-compiler-plugin - 3.2 - 1.6 - 1.6 + 1.8 + 1.8 @@ -126,7 +148,6 @@ org.apache.maven.plugins maven-resources-plugin - 2.7 UTF-8 @@ -135,7 +156,6 @@ org.apache.maven.plugins maven-source-plugin - 2.4 @@ -148,7 +168,6 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.9.1 attach-javadocs @@ -165,7 +184,6 @@ maven-surefire-plugin - 2.19.1 **/*Test.java @@ -176,7 +194,6 @@ maven-deploy-plugin - 2.8.2 false 10 @@ -186,7 +203,6 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 sign-artifacts From 354a5bbb1c74a8f83146411cdbedb799d42c9adf Mon Sep 17 00:00:00 2001 From: Axel Becker Date: Wed, 30 Jan 2019 21:37:27 +0100 Subject: [PATCH 2/5] update to java 8 --- pom.xml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 72236aa01..eeeb181b8 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,5 @@ - 4.0.0 @@ -74,7 +75,7 @@ - + true org.apache.maven.plugins @@ -97,7 +98,7 @@ - + org.sonatype.plugins nexus-staging-maven-plugin @@ -224,6 +225,11 @@ httpclient provided + + org.apache.httpcomponents + httpcore + provided + com.arangodb velocypack @@ -237,7 +243,7 @@ logback-classic test - + junit junit test @@ -256,6 +262,11 @@ httpclient ${httpclient.version} + + org.apache.httpcomponents + httpcore + 4.4.11 + com.arangodb velocypack @@ -271,7 +282,7 @@ logback-classic ${logback-classic.version} - + junit junit ${junit.version} From 58f80a67c7034f1541f041a99ad1358910d92766 Mon Sep 17 00:00:00 2001 From: Axel Becker Date: Wed, 30 Jan 2019 21:43:03 +0100 Subject: [PATCH 3/5] update to java 8 --- pom.xml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pom.xml b/pom.xml index eeeb181b8..b09a3131a 100644 --- a/pom.xml +++ b/pom.xml @@ -230,6 +230,14 @@ httpcore provided + + commons-logging + commons-logging + + + commons-codec + commons-codec + com.arangodb velocypack @@ -267,6 +275,16 @@ httpcore 4.4.11 + + commons-codec + commons-codec + 1.11 + + + commons-logging + commons-logging + 1.2 + com.arangodb velocypack From b69ddd4c86878424e4aaeee1be89dc5a1d1be8d5 Mon Sep 17 00:00:00 2001 From: Axel Becker Date: Wed, 30 Jan 2019 21:59:15 +0100 Subject: [PATCH 4/5] disable doclint --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b09a3131a..28f0deba3 100644 --- a/pom.xml +++ b/pom.xml @@ -68,7 +68,7 @@ [1.8,) - -Xdoclint:none + none From 62d64f9299d05842227ae326e3876880261ee46e Mon Sep 17 00:00:00 2001 From: Alexander Balyshyn Date: Mon, 4 Feb 2019 17:54:48 +0200 Subject: [PATCH 5/5] code-style refactoring, fix Javadoc warnings --- .../java/com/arangodb/ArangoCollection.java | 8 -- src/main/java/com/arangodb/ArangoDB.java | 9 +- .../java/com/arangodb/ArangoDBException.java | 13 ++- .../com/arangodb/ArangoEdgeCollection.java | 8 +- src/main/java/com/arangodb/ArangoGraph.java | 4 +- .../com/arangodb/ArangoVertexCollection.java | 4 +- src/main/java/com/arangodb/ArangoView.java | 4 +- .../com/arangodb/entity/CollectionStatus.java | 100 +++++++++--------- .../com/arangodb/entity/CollectionType.java | 98 ++++++++--------- .../java/com/arangodb/entity/ErrorEntity.java | 1 - .../java/com/arangodb/entity/LogLevel.java | 100 +++++++++--------- .../java/com/arangodb/entity/Permissions.java | 78 +++++++------- .../internal/ArangoCollectionImpl.java | 8 +- .../com/arangodb/util/ArangoDeserializer.java | 92 ++++++++-------- .../com/arangodb/util/ArangoSerializer.java | 2 +- 15 files changed, 264 insertions(+), 265 deletions(-) diff --git a/src/main/java/com/arangodb/ArangoCollection.java b/src/main/java/com/arangodb/ArangoCollection.java index 1dcbd975a..0f0dd8c10 100644 --- a/src/main/java/com/arangodb/ArangoCollection.java +++ b/src/main/java/com/arangodb/ArangoCollection.java @@ -368,11 +368,6 @@ MultiDocumentEntity> updateDocuments( * Documentation * @param key * The key of the document - * @param type - * The type of the document (POJO class, VPackSlice or String for JSON). Only necessary if - * options.returnOld is set to true, otherwise can be null. - * @param options - * Additional options, can be null * @return information about the document * @throws ArangoDBException */ @@ -404,9 +399,6 @@ DocumentDeleteEntity deleteDocument(String key, Class type, DocumentDe * Documentation * @param values * The keys of the documents or the documents themselves - * @param type - * The type of the documents (POJO class, VPackSlice or String for JSON). Only necessary if - * options.returnOld is set to true, otherwise can be null. * @return information about the documents * @throws ArangoDBException */ diff --git a/src/main/java/com/arangodb/ArangoDB.java b/src/main/java/com/arangodb/ArangoDB.java index 6bf3897c1..77713dc26 100644 --- a/src/main/java/com/arangodb/ArangoDB.java +++ b/src/main/java/com/arangodb/ArangoDB.java @@ -603,9 +603,10 @@ public synchronized ArangoDB build() { final ArangoSerialization custom = customSerializer != null ? customSerializer : internal; final ArangoSerializationFactory util = new ArangoSerializationFactory(internal, custom); - final int max = maxConnections != null ? Math.max(1, maxConnections) - : protocol == Protocol.VST ? ArangoDefaults.MAX_CONNECTIONS_VST_DEFAULT - : ArangoDefaults.MAX_CONNECTIONS_HTTP_DEFAULT; + int protocolMaxConnections = protocol == Protocol.VST ? + ArangoDefaults.MAX_CONNECTIONS_VST_DEFAULT : + ArangoDefaults.MAX_CONNECTIONS_HTTP_DEFAULT; + final int max = maxConnections != null ? Math.max(1, maxConnections) : protocolMaxConnections; final ConnectionFactory connectionFactory = (protocol == null || Protocol.VST == protocol) ? new VstConnectionFactorySync(host, timeout, connectionTtl, useSsl, sslContext) @@ -688,7 +689,7 @@ public synchronized ArangoDB build() { * Documentation * @param user * The name of the user for which you want to query the databases - * @return + * @return list of database names which are available for the specified user * @throws ArangoDBException */ Collection getAccessibleDatabasesFor(String user) throws ArangoDBException; diff --git a/src/main/java/com/arangodb/ArangoDBException.java b/src/main/java/com/arangodb/ArangoDBException.java index 4ced182cb..908d6b9ad 100644 --- a/src/main/java/com/arangodb/ArangoDBException.java +++ b/src/main/java/com/arangodb/ArangoDBException.java @@ -29,26 +29,32 @@ public class ArangoDBException extends RuntimeException { private static final long serialVersionUID = 6165638002614173801L; - private ErrorEntity entity = null; - private Integer responseCode; + private final ErrorEntity entity; + private final Integer responseCode; public ArangoDBException(final ErrorEntity errorEntity) { super(String.format("Response: %s, Error: %s - %s", errorEntity.getCode(), errorEntity.getErrorNum(), errorEntity.getErrorMessage())); this.entity = errorEntity; + this.responseCode = null; } public ArangoDBException(final String message) { super(message); + this.entity = null; + this.responseCode = null; } public ArangoDBException(final String message, final Integer responseCode) { super(message); + this.entity = null; this.responseCode = responseCode; } public ArangoDBException(final Throwable cause) { super(cause); + this.entity = null; + this.responseCode = null; } /** @@ -69,7 +75,8 @@ public String getException() { * @return HTTP response code */ public Integer getResponseCode() { - return responseCode != null ? responseCode : entity != null ? entity.getCode() : null; + Integer entityResponseCode = entity != null ? entity.getCode() : null; + return responseCode != null ? responseCode : entityResponseCode; } /** diff --git a/src/main/java/com/arangodb/ArangoEdgeCollection.java b/src/main/java/com/arangodb/ArangoEdgeCollection.java index 66f3bee66..01252c444 100644 --- a/src/main/java/com/arangodb/ArangoEdgeCollection.java +++ b/src/main/java/com/arangodb/ArangoEdgeCollection.java @@ -109,7 +109,7 @@ public interface ArangoEdgeCollection extends ArangoSerializationAccessor { * @see API Documentation * @param key * The key of the edge - * @param type + * @param * The type of the edge-document (POJO class, VPackSlice or String for JSON) * @return information about the edge * @throws ArangoDBException @@ -123,7 +123,7 @@ public interface ArangoEdgeCollection extends ArangoSerializationAccessor { * @see API Documentation * @param key * The key of the edge - * @param type + * @param * The type of the edge-document (POJO class, VPackSlice or String for JSON) * @param options * Additional options, can be null @@ -140,7 +140,7 @@ public interface ArangoEdgeCollection extends ArangoSerializationAccessor { * @see API Documentation * @param key * The key of the edge - * @param type + * @param * The type of the edge-document (POJO class, VPackSlice or String for JSON) * @return information about the edge * @throws ArangoDBException @@ -155,7 +155,7 @@ public interface ArangoEdgeCollection extends ArangoSerializationAccessor { * @see API Documentation * @param key * The key of the edge - * @param type + * @param * The type of the edge-document (POJO class, VPackSlice or String for JSON) * @param options * Additional options, can be null diff --git a/src/main/java/com/arangodb/ArangoGraph.java b/src/main/java/com/arangodb/ArangoGraph.java index 6679dc153..ac02999b4 100644 --- a/src/main/java/com/arangodb/ArangoGraph.java +++ b/src/main/java/com/arangodb/ArangoGraph.java @@ -39,14 +39,14 @@ public interface ArangoGraph extends ArangoSerializationAccessor { * * @return database handler */ - public ArangoDatabase db(); + ArangoDatabase db(); /** * The name of the collection * * @return collection name */ - public String name(); + String name(); /** * Checks whether the graph exists diff --git a/src/main/java/com/arangodb/ArangoVertexCollection.java b/src/main/java/com/arangodb/ArangoVertexCollection.java index 117f2ba3a..f872e51ae 100644 --- a/src/main/java/com/arangodb/ArangoVertexCollection.java +++ b/src/main/java/com/arangodb/ArangoVertexCollection.java @@ -152,7 +152,7 @@ public interface ArangoVertexCollection extends ArangoSerializationAccessor { * @see API Documentation * @param key * The key of the vertex - * @param type + * @param * The type of the vertex-document (POJO class, VPackSlice or String for JSON) * @return information about the vertex * @throws ArangoDBException @@ -167,7 +167,7 @@ public interface ArangoVertexCollection extends ArangoSerializationAccessor { * @see API Documentation * @param key * The key of the vertex - * @param type + * @param * The type of the vertex-document (POJO class, VPackSlice or String for JSON) * @param options * Additional options, can be null diff --git a/src/main/java/com/arangodb/ArangoView.java b/src/main/java/com/arangodb/ArangoView.java index 73fdd3a74..c5ef0d059 100644 --- a/src/main/java/com/arangodb/ArangoView.java +++ b/src/main/java/com/arangodb/ArangoView.java @@ -36,14 +36,14 @@ public interface ArangoView extends ArangoSerializationAccessor { * * @return database handler */ - public ArangoDatabase db(); + ArangoDatabase db(); /** * The name of the view * * @return view name */ - public String name(); + String name(); /** * Checks whether the view exists. diff --git a/src/main/java/com/arangodb/entity/CollectionStatus.java b/src/main/java/com/arangodb/entity/CollectionStatus.java index 0e9f78be4..eea53185a 100644 --- a/src/main/java/com/arangodb/entity/CollectionStatus.java +++ b/src/main/java/com/arangodb/entity/CollectionStatus.java @@ -1,50 +1,50 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.entity; - -/** - * @author Mark Vollmary - * - */ -public enum CollectionStatus { - - NEW_BORN_COLLECTION(1), UNLOADED(2), LOADED(3), IN_THE_PROCESS_OF_BEING_UNLOADED(4), DELETED(5); - - private final int status; - - private CollectionStatus(final int status) { - this.status = status; - } - - public int getStatus() { - return status; - } - - public static CollectionStatus fromStatus(final int status) { - for (final CollectionStatus cStatus : CollectionStatus.values()) { - if (cStatus.status == status) { - return cStatus; - } - } - return null; - } - -} +/* + * DISCLAIMER + * + * Copyright 2016 ArangoDB GmbH, Cologne, Germany + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright holder is ArangoDB GmbH, Cologne, Germany + */ + +package com.arangodb.entity; + +/** + * @author Mark Vollmary + * + */ +public enum CollectionStatus { + + NEW_BORN_COLLECTION(1), UNLOADED(2), LOADED(3), IN_THE_PROCESS_OF_BEING_UNLOADED(4), DELETED(5); + + private final int status; + + CollectionStatus(final int status) { + this.status = status; + } + + public int getStatus() { + return status; + } + + public static CollectionStatus fromStatus(final int status) { + for (final CollectionStatus cStatus : CollectionStatus.values()) { + if (cStatus.status == status) { + return cStatus; + } + } + return null; + } + +} diff --git a/src/main/java/com/arangodb/entity/CollectionType.java b/src/main/java/com/arangodb/entity/CollectionType.java index 963358bab..5b16e1be5 100644 --- a/src/main/java/com/arangodb/entity/CollectionType.java +++ b/src/main/java/com/arangodb/entity/CollectionType.java @@ -1,49 +1,49 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.entity; - -/** - * @author Mark Vollmary - * - */ -public enum CollectionType { - - DOCUMENT(2), EDGES(3); - - private final int type; - - private CollectionType(final int type) { - this.type = type; - } - - public int getType() { - return type; - } - - public static CollectionType fromType(final int type) { - for (final CollectionType cType : CollectionType.values()) { - if (cType.type == type) { - return cType; - } - } - return null; - } -} +/* + * DISCLAIMER + * + * Copyright 2016 ArangoDB GmbH, Cologne, Germany + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright holder is ArangoDB GmbH, Cologne, Germany + */ + +package com.arangodb.entity; + +/** + * @author Mark Vollmary + * + */ +public enum CollectionType { + + DOCUMENT(2), EDGES(3); + + private final int type; + + CollectionType(final int type) { + this.type = type; + } + + public int getType() { + return type; + } + + public static CollectionType fromType(final int type) { + for (final CollectionType cType : CollectionType.values()) { + if (cType.type == type) { + return cType; + } + } + return null; + } +} diff --git a/src/main/java/com/arangodb/entity/ErrorEntity.java b/src/main/java/com/arangodb/entity/ErrorEntity.java index dc798fe63..6e309f16c 100644 --- a/src/main/java/com/arangodb/entity/ErrorEntity.java +++ b/src/main/java/com/arangodb/entity/ErrorEntity.java @@ -48,7 +48,6 @@ public String getErrorMessage() { /** * @return the exception message, passed when transaction fails - * @return */ public String getException() { return exception; diff --git a/src/main/java/com/arangodb/entity/LogLevel.java b/src/main/java/com/arangodb/entity/LogLevel.java index ba3de03df..a3780c883 100644 --- a/src/main/java/com/arangodb/entity/LogLevel.java +++ b/src/main/java/com/arangodb/entity/LogLevel.java @@ -1,50 +1,50 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.entity; - -/** - * @author Mark Vollmary - * - */ -public enum LogLevel { - - FATAL(0), ERROR(1), WARNING(2), INFO(3), DEBUG(4); - - private final int level; - - private LogLevel(final int level) { - this.level = level; - } - - public int getLevel() { - return level; - } - - public static LogLevel fromLevel(final int level) { - for (final LogLevel logLevel : LogLevel.values()) { - if (logLevel.level == level) { - return logLevel; - } - } - return null; - } - -} +/* + * DISCLAIMER + * + * Copyright 2016 ArangoDB GmbH, Cologne, Germany + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright holder is ArangoDB GmbH, Cologne, Germany + */ + +package com.arangodb.entity; + +/** + * @author Mark Vollmary + * + */ +public enum LogLevel { + + FATAL(0), ERROR(1), WARNING(2), INFO(3), DEBUG(4); + + private final int level; + + LogLevel(final int level) { + this.level = level; + } + + public int getLevel() { + return level; + } + + public static LogLevel fromLevel(final int level) { + for (final LogLevel logLevel : LogLevel.values()) { + if (logLevel.level == level) { + return logLevel; + } + } + return null; + } + +} diff --git a/src/main/java/com/arangodb/entity/Permissions.java b/src/main/java/com/arangodb/entity/Permissions.java index 81cdf7c89..34c256ce9 100644 --- a/src/main/java/com/arangodb/entity/Permissions.java +++ b/src/main/java/com/arangodb/entity/Permissions.java @@ -1,39 +1,39 @@ -/* - * DISCLAIMER - * - * Copyright 2017 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.entity; - -/** - * @author Mark Vollmary - * - */ -public enum Permissions { - - /** - * read and write access - */ - RW, - /** - * read-only access - */ - RO, - NONE; - -} +/* + * DISCLAIMER + * + * Copyright 2017 ArangoDB GmbH, Cologne, Germany + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright holder is ArangoDB GmbH, Cologne, Germany + */ + +package com.arangodb.entity; + +/** + * @author Mark Vollmary + * + */ +public enum Permissions { + + /** + * read and write access + */ + RW, + /** + * read-only access + */ + RO, + NONE + +} diff --git a/src/main/java/com/arangodb/internal/ArangoCollectionImpl.java b/src/main/java/com/arangodb/internal/ArangoCollectionImpl.java index 3903aa496..fb3f78154 100644 --- a/src/main/java/com/arangodb/internal/ArangoCollectionImpl.java +++ b/src/main/java/com/arangodb/internal/ArangoCollectionImpl.java @@ -131,8 +131,8 @@ public T getDocument(final String key, final Class type, final DocumentRe if (LOGGER.isDebugEnabled()) { LOGGER.debug(e.getMessage(), e); } - if ((e.getResponseCode() != null && (e.getResponseCode().intValue() == 404 - || e.getResponseCode().intValue() == 304 || e.getResponseCode().intValue() == 412)) + if ((e.getResponseCode() != null && (e.getResponseCode() == 404 + || e.getResponseCode() == 304 || e.getResponseCode() == 412)) && (options == null || options.isCatchException())) { return null; } @@ -252,8 +252,8 @@ public Boolean documentExists(final String key, final DocumentExistsOptions opti executor.execute(documentExistsRequest(key, options), VPackSlice.class); return true; } catch (final ArangoDBException e) { - if ((e.getResponseCode() != null && (e.getResponseCode().intValue() == 404 - || e.getResponseCode().intValue() == 304 || e.getResponseCode().intValue() == 412)) + if ((e.getResponseCode() != null && (e.getResponseCode() == 404 + || e.getResponseCode() == 304 || e.getResponseCode() == 412)) && (options == null || options.isCatchException())) { return false; } diff --git a/src/main/java/com/arangodb/util/ArangoDeserializer.java b/src/main/java/com/arangodb/util/ArangoDeserializer.java index ffb30d8d6..437928315 100644 --- a/src/main/java/com/arangodb/util/ArangoDeserializer.java +++ b/src/main/java/com/arangodb/util/ArangoDeserializer.java @@ -1,46 +1,46 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.util; - -import java.lang.reflect.Type; - -import com.arangodb.ArangoDBException; -import com.arangodb.velocypack.VPackSlice; - -/** - * @author Mark Vollmary - * - */ -public interface ArangoDeserializer { - - /** - * Deserialze a given VelocPack to an instance of a given type - * - * @param vpack - * The VelocyPack to deserialize - * @param type - * The target type to deserialize to. Use String for raw JSON. - * @return The deserialized VelocyPack - * @throws ArangoDBException - */ - T deserialize(final VPackSlice vpack, final Type type) throws ArangoDBException; - -} +/* + * DISCLAIMER + * + * Copyright 2016 ArangoDB GmbH, Cologne, Germany + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright holder is ArangoDB GmbH, Cologne, Germany + */ + +package com.arangodb.util; + +import java.lang.reflect.Type; + +import com.arangodb.ArangoDBException; +import com.arangodb.velocypack.VPackSlice; + +/** + * @author Mark Vollmary + * + */ +public interface ArangoDeserializer { + + /** + * Deserialize a given VelocyPack to an instance of a given type + * + * @param vpack + * The VelocyPack to deserialize + * @param type + * The target type to deserialize to. Use String for raw JSON. + * @return The deserialized VelocyPack + * @throws ArangoDBException + */ + T deserialize(final VPackSlice vpack, final Type type) throws ArangoDBException; + +} diff --git a/src/main/java/com/arangodb/util/ArangoSerializer.java b/src/main/java/com/arangodb/util/ArangoSerializer.java index 219a5be30..fd953bf91 100644 --- a/src/main/java/com/arangodb/util/ArangoSerializer.java +++ b/src/main/java/com/arangodb/util/ArangoSerializer.java @@ -33,7 +33,7 @@ */ public interface ArangoSerializer { - public static class Options { + class Options { private Type type; private boolean serializeNullValues; private Map additionalFields;