From e42f9f132b3f731eb5ff109063fc36aabd8dd77c Mon Sep 17 00:00:00 2001 From: Abdul Qadir Date: Tue, 11 Jul 2023 21:35:41 +0500 Subject: [PATCH] Fix lowcoder api server launch failure - Added exclusion of the mongo-java-driver wrt to spring 3.0 expectation - Update base64 encoding to use java.util.Base64 as org.bson.internal.Base64 is now removed from bson 4.9.1 which spring 3 uses. --- server/api-service/lowcoder-domain/pom.xml | 4 ++++ .../api-service/lowcoder-plugins/graphqlPlugin/pom.xml | 4 ---- .../org/lowcoder/plugin/graphql/GraphQLExecutor.java | 10 +++------- .../api-service/lowcoder-plugins/restApiPlugin/pom.xml | 5 ----- .../org/lowcoder/plugin/restapi/RestApiExecutor.java | 5 ++--- server/api-service/pom.xml | 5 ----- 6 files changed, 9 insertions(+), 24 deletions(-) diff --git a/server/api-service/lowcoder-domain/pom.xml b/server/api-service/lowcoder-domain/pom.xml index 1c85a4906..8b6086c93 100644 --- a/server/api-service/lowcoder-domain/pom.xml +++ b/server/api-service/lowcoder-domain/pom.xml @@ -136,6 +136,10 @@ com.google.guava guava + + org.mongodb + mongo-java-driver + diff --git a/server/api-service/lowcoder-plugins/graphqlPlugin/pom.xml b/server/api-service/lowcoder-plugins/graphqlPlugin/pom.xml index ef794093a..60343e057 100644 --- a/server/api-service/lowcoder-plugins/graphqlPlugin/pom.xml +++ b/server/api-service/lowcoder-plugins/graphqlPlugin/pom.xml @@ -127,10 +127,6 @@ netty-http-authenticator 1.5 - - org.mongodb - mongo-java-driver - diff --git a/server/api-service/lowcoder-plugins/graphqlPlugin/src/main/java/org/lowcoder/plugin/graphql/GraphQLExecutor.java b/server/api-service/lowcoder-plugins/graphqlPlugin/src/main/java/org/lowcoder/plugin/graphql/GraphQLExecutor.java index d9bbb1c59..f2c90b49e 100644 --- a/server/api-service/lowcoder-plugins/graphqlPlugin/src/main/java/org/lowcoder/plugin/graphql/GraphQLExecutor.java +++ b/server/api-service/lowcoder-plugins/graphqlPlugin/src/main/java/org/lowcoder/plugin/graphql/GraphQLExecutor.java @@ -21,11 +21,8 @@ import java.net.URISyntaxException; import java.nio.charset.StandardCharsets; import java.text.ParseException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.Map.Entry; -import java.util.Set; import java.util.concurrent.TimeoutException; import java.util.function.Consumer; import java.util.stream.Collectors; @@ -35,7 +32,6 @@ import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; -import org.bson.internal.Base64; import org.lowcoder.plugin.graphql.constants.ResponseDataType; import org.lowcoder.plugin.graphql.helpers.AuthHelper; import org.lowcoder.plugin.graphql.helpers.BufferingFilter; @@ -427,13 +423,13 @@ private ResponseBodyData parseResponseDataInfo(byte[] body, MediaType contentTyp MediaType.IMAGE_JPEG.equals(contentType) || MediaType.IMAGE_PNG.equals(contentType)) { return ResponseBodyData.builder() - .body(Base64.encode(body)) + .body(Base64.getEncoder().encode(body)) .dataType(ResponseDataType.IMAGE) .build(); } if (BINARY_DATA_TYPES.contains(contentType.toString())) { return ResponseBodyData.builder() - .body(Base64.encode(body)) + .body(Base64.getEncoder().encode(body)) .dataType(ResponseDataType.BINARY) .build(); } diff --git a/server/api-service/lowcoder-plugins/restApiPlugin/pom.xml b/server/api-service/lowcoder-plugins/restApiPlugin/pom.xml index 253d174d2..3558d474e 100644 --- a/server/api-service/lowcoder-plugins/restApiPlugin/pom.xml +++ b/server/api-service/lowcoder-plugins/restApiPlugin/pom.xml @@ -96,11 +96,6 @@ spring-test test - - org.mongodb - mongo-java-driver - - diff --git a/server/api-service/lowcoder-plugins/restApiPlugin/src/main/java/org/lowcoder/plugin/restapi/RestApiExecutor.java b/server/api-service/lowcoder-plugins/restApiPlugin/src/main/java/org/lowcoder/plugin/restapi/RestApiExecutor.java index ed305b346..c10ff8ebc 100644 --- a/server/api-service/lowcoder-plugins/restApiPlugin/src/main/java/org/lowcoder/plugin/restapi/RestApiExecutor.java +++ b/server/api-service/lowcoder-plugins/restApiPlugin/src/main/java/org/lowcoder/plugin/restapi/RestApiExecutor.java @@ -29,7 +29,6 @@ import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; -import org.bson.internal.Base64; import org.lowcoder.plugin.restapi.constants.ResponseDataType; import org.lowcoder.plugin.restapi.helpers.AuthHelper; import org.lowcoder.plugin.restapi.helpers.BufferingFilter; @@ -398,13 +397,13 @@ private ResponseBodyData parseResponseDataInfo(byte[] body, MediaType contentTyp if (isPicture(contentType)) { return ResponseBodyData.builder() - .body(Base64.encode(body)) + .body(Base64.getEncoder().encode(body)) .dataType(ResponseDataType.IMAGE) .build(); } if (isBinary(contentType)) { return ResponseBodyData.builder() - .body(Base64.encode(body)) + .body(Base64.getEncoder().encode(body)) .dataType(ResponseDataType.BINARY) .build(); } diff --git a/server/api-service/pom.xml b/server/api-service/pom.xml index 215ffcb4f..fcc8045ab 100644 --- a/server/api-service/pom.xml +++ b/server/api-service/pom.xml @@ -292,11 +292,6 @@ validation-api 2.0.1.Final - - org.mongodb - mongo-java-driver - 3.12.8 -