diff --git a/client/pom.xml b/client/pom.xml
index d9d656c56..7fa3c8e39 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -25,7 +25,6 @@
1.13
2.2
3.0.1
- 1.2.83
1.69
UTF-8
1.16.1
@@ -80,11 +79,6 @@
javax.servlet-api
${servlet.version}
-
- com.alibaba
- fastjson
- ${fastjson.version}
-
org.bouncycastle
bcpkix-jdk15on
@@ -98,22 +92,22 @@
io.grpc
grpc-netty-shaded
- 1.60.0
+ 1.75.0
io.grpc
grpc-protobuf
- 1.60.0
+ 1.75.0
io.grpc
grpc-stub
- 1.60.0
+ 1.75.0
com.google.protobuf
protobuf-java
- 3.25.1
+ 3.25.5
@@ -192,9 +186,9 @@
protobuf-maven-plugin
0.6.1
- com.google.protobuf:protoc:3.25.1:exe:${os.detected.classifier}
+ com.google.protobuf:protoc:3.25.5:exe:${os.detected.classifier}
grpc-java
- io.grpc:protoc-gen-grpc-java:1.60.0:exe:${os.detected.classifier}
+ io.grpc:protoc-gen-grpc-java:1.75.0:exe:${os.detected.classifier}
diff --git a/client/src/main/java/com/vesoft/nebula/driver/graph/net/GrpcConnection.java b/client/src/main/java/com/vesoft/nebula/driver/graph/net/GrpcConnection.java
index b9365fcbb..47e7e676c 100644
--- a/client/src/main/java/com/vesoft/nebula/driver/graph/net/GrpcConnection.java
+++ b/client/src/main/java/com/vesoft/nebula/driver/graph/net/GrpcConnection.java
@@ -7,7 +7,6 @@
import static com.vesoft.nebula.driver.graph.exception.IOErrorException.E_TIME_OUT;
-import com.alibaba.fastjson.JSON;
import com.google.common.base.Charsets;
import com.google.protobuf.ByteString;
import com.vesoft.nebula.driver.graph.ErrorCode;
@@ -30,6 +29,7 @@
import io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder;
import java.nio.charset.Charset;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLException;
import org.slf4j.Logger;
@@ -108,7 +108,7 @@ public AuthResult authenticate(String user, Map authOptions)
.build();
ByteString userString = user == null ? ByteString.copyFrom("", charset)
: ByteString.copyFrom(user, charset);
- String authInfoString = JSON.toJSONString(authOptions);
+ String authInfoString = toJsonString(authOptions);
AuthRequest authReq = AuthRequest.newBuilder()
.setUsername(userString)
.setAuthInfo(ByteString.copyFrom(authInfoString, charset))
@@ -140,6 +140,61 @@ public AuthResult authenticate(String user, Map authOptions)
}
}
+ static String toJsonString(Map options) {
+ if (options == null) {
+ return "null";
+ }
+ StringBuilder json = new StringBuilder("{");
+ boolean first = true;
+ for (Entry entry : options.entrySet()) {
+ if (!first) {
+ json.append(',');
+ }
+ appendJsonString(json, entry.getKey());
+ json.append(':');
+ appendJsonString(json, String.valueOf(entry.getValue()));
+ first = false;
+ }
+ return json.append('}').toString();
+ }
+
+ private static void appendJsonString(StringBuilder json, String value) {
+ json.append('"');
+ for (int index = 0; index < value.length(); index++) {
+ char character = value.charAt(index);
+ switch (character) {
+ case '"':
+ json.append("\\\"");
+ break;
+ case '\\':
+ json.append("\\\\");
+ break;
+ case '\b':
+ json.append("\\b");
+ break;
+ case '\f':
+ json.append("\\f");
+ break;
+ case '\n':
+ json.append("\\n");
+ break;
+ case '\r':
+ json.append("\\r");
+ break;
+ case '\t':
+ json.append("\\t");
+ break;
+ default:
+ if (character < 0x20) {
+ json.append(String.format("\\u%04x", (int) character));
+ } else {
+ json.append(character);
+ }
+ }
+ }
+ json.append('"');
+ }
+
public ExecuteResponse execute(long sessionID, String stmt, long timeout)
throws IOErrorException {
if (stmt == null) {