X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=datarouter-prov%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdatarouter%2Fprovisioning%2Futils%2FJSONUtilities.java;h=f773599d136e9590c4455e446bef5fe31736d6ee;hb=refs%2Fchanges%2F86%2F93386%2F2;hp=9abd5a83442bc562298c9dd181f83437e4ccff75;hpb=632e4aaf606ca99ddc5a5cba11deb5e2ee2a90c5;p=dmaap%2Fdatarouter.git diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/JSONUtilities.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/JSONUtilities.java index 9abd5a83..f773599d 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/JSONUtilities.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/JSONUtilities.java @@ -21,7 +21,6 @@ * * ******************************************************************************/ - package org.onap.dmaap.datarouter.provisioning.utils; import com.att.eelf.configuration.EELFLogger; @@ -43,24 +42,27 @@ public class JSONUtilities { private JSONUtilities(){ } + /** * Does the String v represent a valid Internet address (with or without a * mask length appended). * - * @param v the string to check + * @param str the string to check * @return true if valid, false otherwise */ - public static boolean validIPAddrOrSubnet(String v) { - String[] pp = {v, ""}; - if (v.indexOf('/') > 0) - pp = v.split("/"); + public static boolean validIPAddrOrSubnet(String str) { + String[] pp = {str, ""}; + if (str.indexOf('/') > 0) { + pp = str.split("/"); + } try { InetAddress addr = InetAddress.getByName(pp[0]); if (pp[1].length() > 0) { // check subnet mask int mask = Integer.parseInt(pp[1]); - if (mask > (addr.getAddress().length * 8)) + if (mask > (addr.getAddress().length * 8)) { return false; + } } return true; } catch (UnknownHostException e) {