Forráskód Böngészése

ZOOKEEPER-1540. ZOOKEEPER-1411 breaks backwards compatibility (Andrew Ferguson via breed)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1389711 13f79535-47bb-0310-9956-ffa450edef68
Benjamin Reed 13 éve
szülő
commit
0b62693cc5

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

@@ -446,7 +446,7 @@ public class QuorumPeerConfig {
                        && clientPortAddress.getPort()!=qs.clientAddr.getPort())) 
                throw new ConfigException("client address for this server (id = " + serverId + ") in static config file is " + clientPortAddress + " is different from client address found in dynamic file: " + qs.clientAddr);                    
            } 
-            if (qs!=null) clientPortAddress = qs.clientAddr;                       
+            if (qs!=null && qs.clientAddr != null) clientPortAddress = qs.clientAddr;                       
             
             // Warn about inconsistent peer type
             LearnerType roleByServersList = quorumVerifier.getObservingMembers().containsKey(serverId) ? LearnerType.OBSERVER

+ 3 - 0
src/java/test/org/apache/zookeeper/server/util/DynamicConfigBCTest.java

@@ -107,6 +107,9 @@ public class DynamicConfigBCTest extends QuorumPeer {
             QuorumPeerConfig config = new QuorumPeerConfig();
             config.parse(confFile.toString());
             
+            Assert.assertTrue(config.getClientPortAddress() != null 
+                && config.getClientPortAddress().getPort() == CLIENT_PORT_QP1);
+
             setDynamicConfigFilename(config.getDynamicConfigFilename());
             setConfigFileName(config.getConfigFilename());
             setConfigBackwardCompatibility(config.getConfigBackwardCompatibility());