kezhuw commented on code in PR #2306:
URL: https://github.com/apache/zookeeper/pull/2306#discussion_r2617073978


##########
zookeeper-server/src/main/java/org/apache/zookeeper/common/ZKConfig.java:
##########
@@ -215,16 +215,39 @@ public void setProperty(String key, String value) {
      *
      * @param configPath path to Configuration file.
      */
-    @SuppressWarnings("deprecation")
     public void addConfiguration(Path configPath) throws ConfigException {
-        addConfiguration(configPath.toFile());
+        Path absoluteConfigPath = configPath.toAbsolutePath();
+        LOG.info("Reading configuration from: {}", absoluteConfigPath);
+        try {
+            File configFile = (new 
VerifyingFileFactory.Builder(LOG).warnForRelativePath()
+                                                               
.failForNonExistingPath()
+                                                               
.build()).validate(configPath.toFile());
+            Properties cfg = new Properties();
+            try (FileInputStream in = new FileInputStream(configFile)) {
+                cfg.load(in);
+            }
+            parseProperties(cfg);
+        } catch (IOException | IllegalArgumentException e) {
+            LOG.error("Error while configuration from: {}", 
absoluteConfigPath, e);
+            String msg = "Error while processing " + absoluteConfigPath;
+            try {
+                Class<?> clazz = 
Class.forName("org.apache.zookeeper.server.quorum.QuorumPeerConfig.ConfigException");

Review Comment:
   > I think we can upgrade 
[ZOOKEEPER-4970](https://issues.apache.org/jira/browse/ZOOKEEPER-4970) to 
deprecate `QuorumPeerConfig.ConfigException` also.
   
   Previously(#2309), only references to `QuorumPeerConfig.ConfigException` 
from client package are deprecated but not the exception.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to