From: Madhu Venugopal Date: Fri, 17 Jan 2014 23:58:30 +0000 (-0800) Subject: Fixing a NullPointerException in Neutron Interface (Bug-323) X-Git-Tag: jenkins-controller-bulk-release-prepare-only-2-1~43 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=33c1fa13dc68676f972179c1865d52828d10cf6f Fixing a NullPointerException in Neutron Interface (Bug-323) Ideally, this condition should never occur. But there seems to be a consistency issue in the ML2 driver which could potentially result in this condition. While we are addressing the root-cause in ODL ML2 driver, we should also patch our side of the interface as well to avoid failing for such conditions when it is harmless for a few usecases. Change-Id: Iff5fdb76b45280aba38607cdcf82715cb4338b05 Signed-off-by: Madhu Venugopal --- diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_IPAllocationPool.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_IPAllocationPool.java index 15ff548a53..dab69917d1 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_IPAllocationPool.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_IPAllocationPool.java @@ -77,15 +77,18 @@ public class NeutronSubnet_IPAllocationPool implements Serializable { * * @param inputString * IPv4 address in dotted decimal format - * @returns high-endian representation of the IPv4 address as a long + * @returns high-endian representation of the IPv4 address as a long. + * This method will return 0 if the input is null. */ static long convert(String inputString) { long ans = 0; - String[] parts = inputString.split("\\."); - for (String part: parts) { - ans <<= 8; - ans |= Integer.parseInt(part); + if (inputString != null) { + String[] parts = inputString.split("\\."); + for (String part: parts) { + ans <<= 8; + ans |= Integer.parseInt(part); + } } return ans; }