markap14 commented on a change in pull request #3932: NIFI-6336 Added code to 
catch port value when it is 0.
URL: https://github.com/apache/nifi/pull/3932#discussion_r357685923
 
 

 ##########
 File path: 
nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java
 ##########
 @@ -743,6 +743,9 @@ public InetSocketAddress getClusterNodeProtocolAddress() {
                 socketAddress = "localhost";
             }
             int socketPort = getClusterNodeProtocolPort();
+            if (socketPort == 0) {
+                throw new RuntimeException("Load balance port cannot be 0. 
Port must be inclusively in the range [1, 65535].");
 
 Review comment:
   The exception message indicates a problem with the Load balancing port. 
However, this is not checking the load balancing port - it's checking the 
Cluster Node Protocol Port (port used to communicate between nodes in the 
cluster). It does appear, though, that the exact same condition exists below, 
in the `getClusterLoadBalanceAddress` method.
   
   It is possible, though, that restricting that may cause unit test or 
integration test failures. Often times, a port of `0` is used for such tests, 
so that the test is more portable, since there's no way to know if some 
specific port will be open in some other environment. Do we have a reason for 
explicitly disallowing it?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to