You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by mi...@apache.org on 2022/12/01 11:13:08 UTC

[incubator-eventmesh] branch master updated: fix issue2238

This is an automated email from the ASF dual-hosted git repository.

mikexue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git


The following commit(s) were added to refs/heads/master by this push:
     new 513669c6b fix issue2238
     new d4f6941b8 Merge pull request #2350 from jonyangx/issue2238
513669c6b is described below

commit 513669c6b2d3743bdfc59c76d0bfc1bb956ec29b
Author: jonyangx <jo...@gmail.com>
AuthorDate: Thu Dec 1 17:31:53 2022 +0800

    fix issue2238
---
 .../trace/pinpoint/config/PinpointConfiguration.java       | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/eventmesh-trace-plugin/eventmesh-trace-pinpoint/src/main/java/org/apache/eventmesh/trace/pinpoint/config/PinpointConfiguration.java b/eventmesh-trace-plugin/eventmesh-trace-pinpoint/src/main/java/org/apache/eventmesh/trace/pinpoint/config/PinpointConfiguration.java
index 8d44d0d0a..12df24f61 100644
--- a/eventmesh-trace-plugin/eventmesh-trace-pinpoint/src/main/java/org/apache/eventmesh/trace/pinpoint/config/PinpointConfiguration.java
+++ b/eventmesh-trace-plugin/eventmesh-trace-pinpoint/src/main/java/org/apache/eventmesh/trace/pinpoint/config/PinpointConfiguration.java
@@ -52,7 +52,7 @@ public final class PinpointConfiguration {
     private static final String CONFIG_FILE = "pinpoint.properties";
 
     private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper()
-        .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+            .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
 
     private static final Properties properties = new Properties();
 
@@ -86,7 +86,7 @@ public final class PinpointConfiguration {
         applicationName = properties.getProperty(APPLICATION_NAME_KEY);
         if (StringUtils.isBlank(applicationName)) {
             applicationName = Optional.ofNullable(System.getProperty(APPLICATION_NAME))
-                .orElse(System.getenv(APPLICATION_NAME));
+                    .orElse(System.getenv(APPLICATION_NAME));
         }
 
         requireNonNull(applicationName, String.format("%s can not be null", APPLICATION_NAME_KEY));
@@ -100,8 +100,8 @@ public final class PinpointConfiguration {
         if (StringUtils.isBlank(agentId)) {
             // refer to: com.navercorp.pinpoint.common.util.IdValidateUtils#validateId
             agentId = StringUtils.substring(agentName, 0, 15)
-                + Constants.HYPHEN
-                + RandomStringUtils.generateNum(8);
+                    + Constants.HYPHEN
+                    + RandomStringUtils.generateNum(8);
         }
 
         Properties temporary = new Properties();
@@ -115,7 +115,7 @@ public final class PinpointConfiguration {
         URL resource = PinpointConfiguration.class.getClassLoader().getResource(CONFIG_FILE);
         if (resource != null) {
             try (InputStream inputStream = resource.openStream();
-                BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
+                 BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
                 if (inputStream.available() > 0) {
                     properties.load(reader);
                 }
@@ -126,9 +126,7 @@ public final class PinpointConfiguration {
         // get from config home
         try {
             String configPath = Constants.EVENTMESH_CONF_HOME + File.separator + CONFIG_FILE;
-            if (new File(configPath).exists()) {
-                properties.load(new BufferedReader(new FileReader(configPath)));
-            }
+            PropertiesUtils.loadPropertiesWhenFileExist(properties, configPath, StandardCharsets.UTF_8);
         } catch (IOException e) {
             throw new IllegalArgumentException(String.format("Can not load %s file from conf", CONFIG_FILE));
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org