Martin Mucha has posted comments on this change. Change subject: engine: Add separate validation for multicast MAC address ......................................................................
Patch Set 3: Code-Review-1 (4 comments) answers. http://gerrit.ovirt.org/#/c/32196/3/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyTemplateCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyTemplateCommand.java: Line 57: private List<PermissionSubject> permissionCheckSubject; Line 58: private List<DiskImage> _templateDisks; Line 59: private StorageDomain sourceDomain; Line 60: private Guid sourceDomainId = Guid.Empty; Line 61: private final static Pattern VALIDATE_MAC_ADDRESS = Pattern.compile("\\p{XDigit}[02468AaCcEe](:\\p{XDigit}{2}){5}"); I think this should be defined on one place. Not saying that VmNic is good place, but better to have these patterns on two places. Line 62: Line 63: /** Line 64: * Constructor for command creation when compensation is applied on startup Line 65: * 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: Pattern.compile(NON_MULTICAST_MAC_ADDRESS_FORMAT).matcher("huhFe:FF:FF:FF:FF:FF").matches() == true 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? 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. 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
