Moti Asayag has posted comments on this change. Change subject: core: add helper methods to VmDeviceCommonUtils. ......................................................................
Patch Set 1: (1 inline comment) .................................................... File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmDeviceCommonUtils.java Line 108: sb.append(" "); so there is uncovered edge case: The white list is: "type=x device =y" The expression is: "type=x device =y " (whiteList.indexOf(expr) >= 0) returns false, despite it is positive case. So either change this method, or enable the search to confirm this case. Else the last device in the white list will fail this condition. I'd recommend on removing the last space and improve the search by searching the pattern followed by space or end of content. Consider using: String expr = "a=1 b=2"; String whiteList = "a=1 b=2"; // true // String whiteList = "a=1 b=2 y=1 x=2"; // true // String whiteList = "y=1 x=2 a=1 b=2 "; // true // String whiteList = "y=1 x=2 a=1 b=2"; // true // String whiteList = "y=1 x=2 a=1 b=22"; // false // String whiteList = "y=1 x=2 a=1 b=22 c=3 d=4 "; // false Pattern pattern = Pattern.compile(String.format("%s[^\\w]+|%s$", expr, expr)); System.out.println(pattern.matcher(whiteList).find()); -- To view, visit http://gerrit.ovirt.org/2407 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibcc9d03601cf34becd0b5767cb6702e537860449 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <emes...@redhat.com> Gerrit-Reviewer: Eli Mesika <emes...@redhat.com> Gerrit-Reviewer: Moti Asayag <masa...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches