nagaboinaramgopal opened a new pull request, #14025:
URL: https://github.com/apache/cloudstack/pull/14025

   ### Description
   
   `assignSourceNatPublicIpAddress` looks up the requested IP with
   `findByIpAndDcId` and then reads its state:
   
       IPAddressVO ipAddressVO = _ipAddressDao.findByIpAndDcId(dcId, 
requestedIp);
       if (ipAddressVO.getState() != State.Free) {
   
   `findByIpAndDcId` returns null when the requested IP is not a known public 
IP in
   the zone, so this throws a NullPointerException instead of a meaningful 
error.
   Fixed by null-checking the result first, so the method throws the intended
   `InsufficientAddressCapacityException` when the IP cannot be found.
   
   ### Types of changes
   
   - [x] Bug fix (non-breaking change which fixes an issue)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Bug Severity
   
   - [x] Minor
   
   ### How Has This Been Tested?
   
   Added a unit test that requests a source NAT IP not present in the zone and
   asserts an InsufficientAddressCapacityException is thrown instead of an NPE.
   Also built the standard packages and deployed on a KVM advanced zone.


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