Parcourir la source

ZOOKEEPER-2030 dynamicConfigFile should have an absolute path, not a relative
path, to the dynamic configuration file (Alexander Shraer via michim)


git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1625462 13f79535-47bb-0310-9956-ffa450edef68

Michi Mutsuzaki il y a 11 ans
Parent
commit
7af77531b0

+ 3 - 0
CHANGES.txt

@@ -10,6 +10,9 @@ IMPROVEMENTS:
   ZOOKEEPER-2017 New tests for reconfig failure cases (Alexander Shraer and
   Hongchao Deng via michim)
 
+  ZOOKEEPER-2030 dynamicConfigFile should have an absolute path, not a relative
+  path, to the dynamic configuration file (Alexander Shraer via michim)
+
 Release 3.5.0 - 8/4/2014
 
 NEW FEATURES:

+ 6 - 1
src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java

@@ -405,6 +405,11 @@ public class QuorumPeerConfig {
                 .failForNonExistingPath()
                 .build()).create(configFileStr);
 
+        final File dynamicFile = (new VerifyingFileFactory.Builder(LOG)
+                .warnForRelativePath()
+                .failForNonExistingPath()
+                .build()).create(dynamicFileStr);
+        
         final Properties cfg = new Properties();
         FileInputStream in = new FileInputStream(configFile);
         try {
@@ -436,7 +441,7 @@ public class QuorumPeerConfig {
 
                 // updates the dynamic file pointer
                 out.write("dynamicConfigFile="
-                         .concat(dynamicFileStr)
+                         .concat(dynamicFile.getCanonicalPath())
                          .concat("\n"));
             }
         });