From 3d67faad09579f2b12e78a90ed8f310559da9062 Mon Sep 17 00:00:00 2001 From: FrostyHec <112929809+FrostyHec@users.noreply.github.com> Date: Wed, 16 Oct 2024 00:30:19 +0800 Subject: [PATCH 1/3] fix charset config and add check and init --- .../src/main/java/org/apache/hugegraph/HugeGraphHubble.java | 4 ++++ .../hubble-dist/assembly/static/bin/start-hubble.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hugegraph-hubble/hubble-be/src/main/java/org/apache/hugegraph/HugeGraphHubble.java b/hugegraph-hubble/hubble-be/src/main/java/org/apache/hugegraph/HugeGraphHubble.java index 5e25ed8c5..1c0019361 100644 --- a/hugegraph-hubble/hubble-be/src/main/java/org/apache/hugegraph/HugeGraphHubble.java +++ b/hugegraph-hubble/hubble-be/src/main/java/org/apache/hugegraph/HugeGraphHubble.java @@ -27,6 +27,9 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.scheduling.annotation.EnableScheduling; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; + @SpringBootApplication @EnableScheduling @MapperScan("org.apache.hugegraph.mapper") @@ -38,6 +41,7 @@ public static void main(String[] args) { } public static void initEnv() { + Ex.check(Charset.defaultCharset().equals(StandardCharsets.UTF_8),"Charset must be UTF-8"); String hubbleHomePath = System.getProperty("hubble.home.path"); Ex.check(StringUtils.isNotEmpty(hubbleHomePath), "The system property 'hubble.home.path' must be set"); diff --git a/hugegraph-hubble/hubble-dist/assembly/static/bin/start-hubble.sh b/hugegraph-hubble/hubble-dist/assembly/static/bin/start-hubble.sh index 2626e0a5d..cecdb2435 100644 --- a/hugegraph-hubble/hubble-dist/assembly/static/bin/start-hubble.sh +++ b/hugegraph-hubble/hubble-dist/assembly/static/bin/start-hubble.sh @@ -42,7 +42,7 @@ for jar in "${LIB_PATH}"/*.jar; do class_path=${class_path}:${jar} done -JAVA_OPTS="-Xms512m" +JAVA_OPTS="-Xms512m -Dfile.encoding=UTF-8" JAVA_DEBUG_OPTS="" FOREGROUND="false" From f2e7ed714d0fc34be23f6cc45a607b4e22c7eed4 Mon Sep 17 00:00:00 2001 From: FrostyHec <112929809+FrostyHec@users.noreply.github.com> Date: Thu, 17 Oct 2024 13:10:21 +0800 Subject: [PATCH 2/3] fix charset config and add check at init --- .../src/main/java/org/apache/hugegraph/HugeGraphHubble.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hugegraph-hubble/hubble-be/src/main/java/org/apache/hugegraph/HugeGraphHubble.java b/hugegraph-hubble/hubble-be/src/main/java/org/apache/hugegraph/HugeGraphHubble.java index 1c0019361..b4587d4c0 100644 --- a/hugegraph-hubble/hubble-be/src/main/java/org/apache/hugegraph/HugeGraphHubble.java +++ b/hugegraph-hubble/hubble-be/src/main/java/org/apache/hugegraph/HugeGraphHubble.java @@ -41,7 +41,8 @@ public static void main(String[] args) { } public static void initEnv() { - Ex.check(Charset.defaultCharset().equals(StandardCharsets.UTF_8),"Charset must be UTF-8"); + System.setProperty("file.encoding", "UTF-8"); + Ex.check(Charset.defaultCharset().equals(StandardCharsets.UTF_8),"Charset must be UTF-8, current:"+Charset.defaultCharset()); String hubbleHomePath = System.getProperty("hubble.home.path"); Ex.check(StringUtils.isNotEmpty(hubbleHomePath), "The system property 'hubble.home.path' must be set"); From 60e35a2d1f20d421c762b4f5c13e2464e028c3ba Mon Sep 17 00:00:00 2001 From: FrostyHec <112929809+FrostyHec@users.noreply.github.com> Date: Thu, 17 Oct 2024 13:12:38 +0800 Subject: [PATCH 3/3] reformat --- .../src/main/java/org/apache/hugegraph/HugeGraphHubble.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hugegraph-hubble/hubble-be/src/main/java/org/apache/hugegraph/HugeGraphHubble.java b/hugegraph-hubble/hubble-be/src/main/java/org/apache/hugegraph/HugeGraphHubble.java index b4587d4c0..e5057b962 100644 --- a/hugegraph-hubble/hubble-be/src/main/java/org/apache/hugegraph/HugeGraphHubble.java +++ b/hugegraph-hubble/hubble-be/src/main/java/org/apache/hugegraph/HugeGraphHubble.java @@ -42,10 +42,11 @@ public static void main(String[] args) { public static void initEnv() { System.setProperty("file.encoding", "UTF-8"); - Ex.check(Charset.defaultCharset().equals(StandardCharsets.UTF_8),"Charset must be UTF-8, current:"+Charset.defaultCharset()); + Ex.check(Charset.defaultCharset().equals(StandardCharsets.UTF_8), + "Charset must be UTF-8, current:" + Charset.defaultCharset()); String hubbleHomePath = System.getProperty("hubble.home.path"); Ex.check(StringUtils.isNotEmpty(hubbleHomePath), - "The system property 'hubble.home.path' must be set"); + "The system property 'hubble.home.path' must be set"); String loaderHomePath = System.getProperty("loader.home.path"); if (StringUtils.isEmpty(loaderHomePath)) { System.setProperty("loader.home.path", hubbleHomePath);