Yevgeny Zaspitsky has posted comments on this change. Change subject: engine: Add separate validation for multicast MAC address ......................................................................
Patch Set 3: (3 comments) http://gerrit.ovirt.org/#/c/32196/3/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VmNic.java File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VmNic.java: Line 18: private static final long serialVersionUID = 7428150502868988886L; Line 19: Line 20: private static final String ODD_HEX_DIGIT_PATTERN = "[13579BbDdFf]"; Line 21: Line 22: public static final String NON_MULTICAST_MAC_ADDRESS_FORMAT = > either misleading name or wrong pattern: the constant name is intended to say that it matches everything else than a multicast mac address. you're welcome to propose a better name. Line 23: ".*(?<!^\\p{XDigit}" + ODD_HEX_DIGIT_PATTERN + "(:\\p{XDigit}{2}){5}$)"; Line 24: public static final String VALID_MAC_ADDRESS_FORMAT = Line 25: "^(\\p{XDigit}{2}:){5}\\p{XDigit}{2}$"; Line 26: Line 19: Line 20: private static final String ODD_HEX_DIGIT_PATTERN = "[13579BbDdFf]"; Line 21: Line 22: public static final String NON_MULTICAST_MAC_ADDRESS_FORMAT = Line 23: ".*(?<!^\\p{XDigit}" + ODD_HEX_DIGIT_PATTERN + "(:\\p{XDigit}{2}){5}$)"; > is negative lookbehind needed? Cant' be EVEN_HEX_DIGIT_PATTERN used? the negative pattern is needed as all patterns are evaluated and all violations being reported (it does not stop on the first violation). A positive pattern was used prior to this change and is the root cause for the bug this change is intended to fix. Line 24: public static final String VALID_MAC_ADDRESS_FORMAT = Line 25: "^(\\p{XDigit}{2}:){5}\\p{XDigit}{2}$"; Line 26: Line 27: public static final String NON_NULLABLE_MAC_ADDRESS_FORMAT = "^.*(?<!(00:){5}00)$"; Line 23: ".*(?<!^\\p{XDigit}" + ODD_HEX_DIGIT_PATTERN + "(:\\p{XDigit}{2}){5}$)"; Line 24: public static final String VALID_MAC_ADDRESS_FORMAT = Line 25: "^(\\p{XDigit}{2}:){5}\\p{XDigit}{2}$"; Line 26: Line 27: public static final String NON_NULLABLE_MAC_ADDRESS_FORMAT = "^.*(?<!(00:){5}00)$"; > same. isn't mine, but the same explanation Line 28: Line 29: protected static final String VALIDATION_MESSAGE_MAC_ADDRESS_NOT_NULL = Line 30: "VALIDATION.VM.NETWORK.MAC.ADDRESS.NOT_NULL"; Line 31: protected static final String VALIDATION_MESSAGE_NAME_NOT_NULL = "VALIDATION.VM.NETWORK.NAME.NOT_NULL"; -- To view, visit http://gerrit.ovirt.org/32196 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4077a14fb61c2e082db9f81f1ded3b25ca98fc3f Gerrit-PatchSet: 3 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yevgeny Zaspitsky <[email protected]> Gerrit-Reviewer: Lior Vernia <[email protected]> Gerrit-Reviewer: Martin Mucha <[email protected]> Gerrit-Reviewer: Moti Asayag <[email protected]> Gerrit-Reviewer: Yevgeny Zaspitsky <[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
