Skip to content

Commit a87a441

Browse files
adutraolim7t
authored andcommitted
JAVA-2827: Remove dependency to Tinkerpop gremlin-driver
1 parent 811412a commit a87a441

7 files changed

Lines changed: 14 additions & 35 deletions

File tree

changelog/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### 4.9.0 (in progress)
66

7+
- [improvement] JAVA-2827: Remove dependency to Tinkerpop gremlin-driver
78
- [task] JAVA-2859: Upgrade Tinkerpop to 3.4.8
89
- [bug] JAVA-2726: Fix Tinkerpop incompatibility with JPMS
910
- [bug] JAVA-2842: Remove security vulnerabilities introduced by Tinkerpop

core-shaded/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@
9292
<groupId>org.apache.tinkerpop</groupId>
9393
<artifactId>gremlin-core</artifactId>
9494
</dependency>
95-
<dependency>
96-
<groupId>org.apache.tinkerpop</groupId>
97-
<artifactId>gremlin-driver</artifactId>
98-
</dependency>
9995
<dependency>
10096
<groupId>org.apache.tinkerpop</groupId>
10197
<artifactId>tinkergraph-gremlin</artifactId>

core/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@
9999
<groupId>org.apache.tinkerpop</groupId>
100100
<artifactId>tinkergraph-gremlin</artifactId>
101101
</dependency>
102-
<dependency>
103-
<groupId>org.apache.tinkerpop</groupId>
104-
<artifactId>gremlin-driver</artifactId>
105-
</dependency>
106102
<dependency>
107103
<groupId>com.fasterxml.jackson.core</groupId>
108104
<artifactId>jackson-core</artifactId>

core/src/main/java/com/datastax/dse/driver/internal/core/graph/binary/AbstractSimpleGraphBinaryCustomSerializer.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import com.datastax.oss.driver.shaded.guava.common.base.Preconditions;
1919
import java.io.IOException;
20-
import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
2120
import org.apache.tinkerpop.gremlin.structure.io.Buffer;
2221
import org.apache.tinkerpop.gremlin.structure.io.binary.DataType;
2322
import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader;
@@ -78,8 +77,7 @@ public T read(Buffer buffer, GraphBinaryReader context) throws IOException {
7877
// read {custom_type_info_length} and verify it is 0.
7978
// See #write(T, ByteBuf, GraphBinaryWriter) for why it is set to 0
8079
if (context.readValue(buffer, Integer.class, false) != 0) {
81-
throw new SerializationException(
82-
"{custom_type_info} should not be provided for this custom type");
80+
throw new IOException("{custom_type_info} should not be provided for this custom type");
8381
}
8482

8583
return readValue(buffer, context, true);
@@ -105,11 +103,11 @@ public T readValue(Buffer buffer, GraphBinaryReader context, boolean nullable)
105103
final int valueLength = buffer.readInt();
106104

107105
if (valueLength <= 0) {
108-
throw new SerializationException(String.format("Unexpected value length: %d", valueLength));
106+
throw new IOException(String.format("Unexpected value length: %d", valueLength));
109107
}
110108

111109
if (valueLength > buffer.readableBytes()) {
112-
throw new SerializationException(
110+
throw new IOException(
113111
String.format(
114112
"Not enough readable bytes: %d bytes required for value (%d bytes available)",
115113
valueLength, buffer.readableBytes()));
@@ -134,7 +132,7 @@ public void writeValue(
134132
throws IOException {
135133
if (value == null) {
136134
if (!nullable) {
137-
throw new SerializationException("Unexpected null value when nullable is false");
135+
throw new IOException("Unexpected null value when nullable is false");
138136
}
139137

140138
// writes {value_flag} to "1" which means "the value is null"

core/src/main/java/com/datastax/dse/driver/internal/core/graph/binary/buffer/DseNettyBufferFactory.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,26 @@
1515
*/
1616
package com.datastax.dse.driver.internal.core.graph.binary.buffer;
1717

18-
import io.netty.buffer.*;
18+
import io.netty.buffer.ByteBuf;
19+
import io.netty.buffer.ByteBufAllocator;
20+
import io.netty.buffer.CompositeByteBuf;
21+
import io.netty.buffer.Unpooled;
22+
import io.netty.buffer.UnpooledByteBufAllocator;
1923
import java.nio.ByteBuffer;
2024
import java.util.function.Supplier;
21-
import org.apache.tinkerpop.gremlin.driver.ser.NettyBufferFactory;
2225
import org.apache.tinkerpop.gremlin.structure.io.Buffer;
2326
import org.apache.tinkerpop.gremlin.structure.io.BufferFactory;
2427

2528
/**
2629
* Internal BufferFactory impl for creation of Tinkerpop buffers. We implement an internal type here
2730
* to allow for this class to use shaded Netty types (without bringing all of Tinkerpop into the
28-
* shaded JAR). The impl is based on the initial impl of {@link NettyBufferFactory} but we don't
29-
* guarantee that this class will mirror changes to that class over time.
31+
* shaded JAR). The impl is based on the initial impl of {@code
32+
* org.apache.tinkerpop.gremlin.driver.ser.NettyBufferFactory} but we don't guarantee that this
33+
* class will mirror changes to that class over time.
3034
*/
3135
public class DseNettyBufferFactory implements BufferFactory<ByteBuf> {
3236

33-
private static ByteBufAllocator DEFAULT_ALLOCATOR = new UnpooledByteBufAllocator(false);
37+
private static final ByteBufAllocator DEFAULT_ALLOCATOR = new UnpooledByteBufAllocator(false);
3438

3539
private final ByteBufAllocator allocator;
3640

osgi-tests/src/test/java/com/datastax/oss/driver/internal/osgi/support/BundleOptions.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,6 @@ public static CompositeOption tinkerpopBundles() {
139139
"org.apache.tinkerpop.gremlin.util.*")
140140
.bundleSymbolicName("org.apache.tinkerpop.gremlin-core")
141141
.overwriteManifest(WrappedUrlProvisionOption.OverwriteMode.FULL),
142-
CoreOptions.wrappedBundle(
143-
mavenBundle("org.apache.tinkerpop", "gremlin-driver").versionAsInProject())
144-
.exports("org.apache.tinkerpop.gremlin.driver.*")
145-
.bundleSymbolicName("org.apache.tinkerpop.gremlin-driver")
146-
.overwriteManifest(WrappedUrlProvisionOption.OverwriteMode.FULL),
147142
CoreOptions.wrappedBundle(
148143
mavenBundle("org.apache.tinkerpop", "tinkergraph-gremlin").versionAsInProject())
149144
.exports("org.apache.tinkerpop.gremlin.tinkergraph.*")

pom.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,6 @@
161161
<artifactId>tinkergraph-gremlin</artifactId>
162162
<version>${tinkerpop.version}</version>
163163
</dependency>
164-
<dependency>
165-
<groupId>org.apache.tinkerpop</groupId>
166-
<artifactId>gremlin-driver</artifactId>
167-
<version>${tinkerpop.version}</version>
168-
<exclusions>
169-
<exclusion>
170-
<groupId>io.netty</groupId>
171-
<artifactId>netty-all</artifactId>
172-
</exclusion>
173-
</exclusions>
174-
</dependency>
175164
<dependency>
176165
<groupId>org.reactivestreams</groupId>
177166
<artifactId>reactive-streams</artifactId>

0 commit comments

Comments
 (0)