Skip to content

Commit 03eb490

Browse files
committed
cleaned code
1 parent ce6cc86 commit 03eb490

File tree

6 files changed

+9
-30
lines changed

6 files changed

+9
-30
lines changed

core/src/main/java/com/arangodb/internal/serde/InternalSerializers.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void serialize(RawJson value, JsonGenerator gen, SerializerProvider seria
3030
@Override
3131
public void serialize(RawBytes value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
3232
// TODO: find a way to append raw bytes directly
33-
// see https://github.com/FasterXML/jackson-dataformats-binary/issues/331
33+
// see https://github.com/FasterXML/jackson-core/issues/914
3434
try (JsonParser parser = gen.getCodec().getFactory().createParser(value.get())) {
3535
gen.writeTree(parser.readValueAsTree());
3636
}

core/src/main/java/com/arangodb/internal/serde/UserDataSerializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class UserDataSerializer extends JsonSerializer<Object> {
1717
@Override
1818
public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
1919
// TODO: find a way to append raw bytes directly
20-
// see https://github.com/FasterXML/jackson-dataformats-binary/issues/331
20+
// see https://github.com/FasterXML/jackson-core/issues/914
2121
try (JsonParser parser = gen.getCodec().getFactory().createParser(serde.serializeUserData(value))) {
2222
gen.writeTree(parser.readValueAsTree());
2323
}

core/src/main/java/com/arangodb/internal/util/ResponseUtils.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,6 @@ private ResponseUtils() {
4242
super();
4343
}
4444

45-
// FIXME: remove
46-
public static void checkError(final InternalSerde util, final InternalResponse response) {
47-
final int responseCode = response.getResponseCode();
48-
if (responseCode >= ERROR_STATUS) {
49-
if (responseCode == ERROR_INTERNAL && response.containsMeta(HEADER_ENDPOINT)) {
50-
throw new ArangoDBRedirectException(String.format("Response Code: %s", responseCode),
51-
response.getMeta(HEADER_ENDPOINT));
52-
} else if (response.getBody() != null) {
53-
final ErrorEntity errorEntity = util.deserialize(response.getBody(), ErrorEntity.class);
54-
ArangoDBException e = new ArangoDBException(errorEntity);
55-
if (ArangoErrors.QUEUE_TIME_VIOLATED.equals(e.getErrorNum())) {
56-
throw ArangoDBException.of(new TimeoutException().initCause(e));
57-
}
58-
throw e;
59-
} else {
60-
throw new ArangoDBException(String.format("Response Code: %s", responseCode), responseCode);
61-
}
62-
}
63-
}
64-
6545
public static ArangoDBException translateError(final InternalSerde util, final InternalResponse response) {
6646
final int responseCode = response.getResponseCode();
6747
if (responseCode >= ERROR_STATUS) {

driver/src/test/java/com/arangodb/ConcurrencyAsyncTests.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,16 @@
1919

2020
class ConcurrencyAsyncTests {
2121

22-
/**
23-
* FIXME: make the user executor configurable in com.arangodb.internal.ArangoExecutorAsync::execute
24-
* (eg. this test passes using a CachedThreadPool)
25-
*/
26-
@Disabled
2722
@ParameterizedTest
2823
@EnumSource(Protocol.class)
2924
@Timeout(2)
3025
void executorLimit(Protocol protocol) {
3126
ArangoDBAsync adb = new ArangoDB.Builder()
3227
.loadProperties(ConfigUtils.loadConfig())
3328
.maxConnections(1)
34-
.protocol(protocol).build().async();
29+
.protocol(protocol)
30+
.asyncExecutor(Executors.newCachedThreadPool())
31+
.build().async();
3532

3633
List<CompletableFuture<ArangoDBVersion>> futures = IntStream.range(0, 20)
3734
.mapToObj(i -> adb.getVersion()
@@ -64,6 +61,7 @@ void executorLimit(Protocol protocol) {
6461
void outgoingRequestsParallelismTest(Protocol protocol) {
6562
ArangoDBAsync adb = new ArangoDB.Builder()
6663
.loadProperties(ConfigUtils.loadConfig())
64+
.maxConnections(20)
6765
.protocol(protocol).build().async();
6866

6967
for (int i = 0; i < 50_000; i++) {

http/src/main/java/com/arangodb/http/HttpCommunication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ private CompletableFuture<InternalResponse> executeAsync(final InternalRequest r
121121
}
122122
}
123123
} catch (Exception ex) {
124-
rfuture.completeExceptionally(ex);
124+
rfuture.completeExceptionally(ArangoDBException.of(ex));
125125
}
126126
});
127127
return rfuture;

vst/src/main/java/com/arangodb/vst/VstCommunication.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ protected R execute(final InternalRequest request, final HostHandle hostHandle,
150150
protected abstract R execute(final InternalRequest request, C connection, final int attemptCount);
151151

152152
protected void checkError(final InternalResponse response) {
153-
ResponseUtils.checkError(serde, response);
153+
ArangoDBException e = ResponseUtils.translateError(serde, response);
154+
if (e != null) throw e;
154155
}
155156

156157
protected InternalResponse createResponse(final Message message) throws VPackParserException {

0 commit comments

Comments
 (0)