This is an automated email from the ASF dual-hosted git repository. jin pushed a commit to branch docker-1.3.0 in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-toolchain.git
commit c2dcd719ae271ffd2b5f4dcb8f029a469e9edb44 Author: Forster <[email protected]> AuthorDate: Thu Oct 24 19:41:22 2024 +0800 fix(hubble): encode/decode Chinese error after building package (#627) --- .../src/main/java/org/apache/hugegraph/HugeGraphHubble.java | 5 +++++ hugegraph-hubble/hubble-dist/assembly/static/bin/start-hubble.sh | 2 +- hugegraph-hubble/hubble-dist/assembly/travis/download-hugegraph.sh | 1 + .../hubble-dist/assembly/travis/install-hugegraph-hubble.sh | 1 + hugegraph-hubble/hubble-dist/assembly/travis/install-hugegraph.sh | 1 + hugegraph-hubble/hubble-dist/assembly/travis/run-api-test.sh | 1 + hugegraph-hubble/hubble-dist/assembly/travis/start-hubble.sh | 2 +- 7 files changed, 11 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 5e25ed8c..e0c20827 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.builder.SpringApplicationBuilder; 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,8 @@ public class HugeGraphHubble extends SpringBootServletInitializer { } public static void initEnv() { + 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"); 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 2626e0a5..cecdb243 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" diff --git a/hugegraph-hubble/hubble-dist/assembly/travis/download-hugegraph.sh b/hugegraph-hubble/hubble-dist/assembly/travis/download-hugegraph.sh index ac4cf585..7e9c40eb 100755 --- a/hugegraph-hubble/hubble-dist/assembly/travis/download-hugegraph.sh +++ b/hugegraph-hubble/hubble-dist/assembly/travis/download-hugegraph.sh @@ -15,6 +15,7 @@ # License for the specific language governing permissions and limitations # under the License. # +export LANG=zh_CN.UTF-8 set -ev if [[ $# -ne 1 ]]; then diff --git a/hugegraph-hubble/hubble-dist/assembly/travis/install-hugegraph-hubble.sh b/hugegraph-hubble/hubble-dist/assembly/travis/install-hugegraph-hubble.sh index 53f37f70..67427456 100755 --- a/hugegraph-hubble/hubble-dist/assembly/travis/install-hugegraph-hubble.sh +++ b/hugegraph-hubble/hubble-dist/assembly/travis/install-hugegraph-hubble.sh @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +export LANG=zh_CN.UTF-8 set -ev TRAVIS_DIR=$(dirname "$0") diff --git a/hugegraph-hubble/hubble-dist/assembly/travis/install-hugegraph.sh b/hugegraph-hubble/hubble-dist/assembly/travis/install-hugegraph.sh index 1b2eb1ba..920968c0 100755 --- a/hugegraph-hubble/hubble-dist/assembly/travis/install-hugegraph.sh +++ b/hugegraph-hubble/hubble-dist/assembly/travis/install-hugegraph.sh @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +export LANG=zh_CN.UTF-8 set -ev COMMIT_ID=$1 diff --git a/hugegraph-hubble/hubble-dist/assembly/travis/run-api-test.sh b/hugegraph-hubble/hubble-dist/assembly/travis/run-api-test.sh index 67000fad..9be2b322 100755 --- a/hugegraph-hubble/hubble-dist/assembly/travis/run-api-test.sh +++ b/hugegraph-hubble/hubble-dist/assembly/travis/run-api-test.sh @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +export LANG=zh_CN.UTF-8 set -ev TRAVIS_DIR="hubble-dist/assembly/travis" diff --git a/hugegraph-hubble/hubble-dist/assembly/travis/start-hubble.sh b/hugegraph-hubble/hubble-dist/assembly/travis/start-hubble.sh index a806a0f6..efbfbd33 100644 --- a/hugegraph-hubble/hubble-dist/assembly/travis/start-hubble.sh +++ b/hugegraph-hubble/hubble-dist/assembly/travis/start-hubble.sh @@ -80,7 +80,7 @@ args=${CONF_PATH}/hugegraph-hubble.properties log=${LOG_PATH}/hugegraph-hubble.log echo -n "starting HugeGraphHubble " -nohup nice -n 0 java -server "${java_opts}" "${agent_opts}" -Dhubble.home.path="${HOME_PATH}" -cp "${class_path}" ${main_class} "${args}" > "${log}" 2>&1 < /dev/null & +nohup nice -n 0 java -server -Dfile.encoding=UTF-8 "${java_opts}" "${agent_opts}" -Dhubble.home.path="${HOME_PATH}" -cp "${class_path}" ${main_class} "${args}" > "${log}" 2>&1 < /dev/null & pid=$! echo ${pid} > "${PID_FILE}"
