Moti Asayag has posted comments on this change. Change subject: tools: CidrValidation Utils ......................................................................
Patch Set 1: (2 comments) http://gerrit.ovirt.org/#/c/32539/1/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/validation/CidrValidator.java File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/validation/CidrValidator.java: Line 34: } Line 35: Line 36: private static int getMaskFromCidr(String cidr) { Line 37: String[] temp = cidr.split("/"); Line 38: return Integer.parseInt(temp[1]); > i need to extract ip and mask from the cidr. the two private methods could be replaced with this: String[] temp = cidr.split("/"); String ipAsString = temp[0]; int mask = Integer.parseInt(temp[1]); Line 39: } Line 40: Line 41: private static String getIpFromCidr(String cidr) { Line 42: String[] temp = cidr.split("/"); Line 58: private static boolean isNetworkAddress(int ip, int mask) { Line 59: int temp = 1; Line 60: int check = 0; Line 61: for (int i = 0; i < mask; i++) { Line 62: check = temp & ip; > can do (temp & ip != 0) please inline. Line 63: if (check != 0) { Line 64: return false; Line 65: } Line 66: temp <<= 1; -- To view, visit http://gerrit.ovirt.org/32539 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib1277dbc815953926fe1648350cd55cb75e1084a Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eliraz Levi <[email protected]> Gerrit-Reviewer: Alona Kaplan <[email protected]> Gerrit-Reviewer: Eliraz Levi <[email protected]> Gerrit-Reviewer: Moti Asayag <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
