kezhenxu94 commented on a change in pull request #4264: Refactor 
SnifferConfigInitializer and related componets with new features in JDK8+
URL: https://github.com/apache/skywalking/pull/4264#discussion_r367986163
 
 

 ##########
 File path: 
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java
 ##########
 @@ -172,24 +189,64 @@ private static void overrideConfigBySystemProp() throws 
IllegalAccessException {
     /**
      * Load the specified config file or default config file
      *
-     * @return the config file {@link InputStream}, or null if not needEnhance.
+     * @return the config file {@link InputStream}
      */
-    private static InputStreamReader loadConfig() throws 
AgentPackageNotFoundException, ConfigNotFoundException, 
ConfigReadFailedException {
+    private static InputStreamReader loadConfig() throws 
AgentPackageNotFoundException, ConfigNotFoundException {
 
         String specifiedConfigPath = 
System.getProperties().getProperty(SPECIFIED_CONFIG_PATH);
-        File configFile = StringUtil.isEmpty(specifiedConfigPath) ? new 
File(AgentPackagePath.getPath(), DEFAULT_CONFIG_FILE_NAME) : new 
File(specifiedConfigPath);
+        File configFile = StringUtil.isBlank(specifiedConfigPath) ? new 
File(AgentPackagePath.getPath(), DEFAULT_CONFIG_FILE_NAME) : new 
File(specifiedConfigPath);
 
         if (configFile.exists() && configFile.isFile()) {
             try {
                 logger.info("Config file found in {}.", configFile);
 
-                return new InputStreamReader(new FileInputStream(configFile), 
"UTF-8");
+                return new InputStreamReader(new FileInputStream(configFile), 
StandardCharsets.UTF_8);
             } catch (FileNotFoundException e) {
                 throw new ConfigNotFoundException("Failed to load 
agent.config", e);
-            } catch (UnsupportedEncodingException e) {
-                throw new ConfigReadFailedException("Failed to load 
agent.config", e);
             }
         }
         throw new ConfigNotFoundException("Failed to load agent.config.");
     }
+
+    /**
+     * Option container.
+     *
+     * @author johnniang
+     */
+    private static class Option {
 
 Review comment:
   Use Lombok annotations to get rid of boilerplate codes (getters setters)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to