Alon Bar-Lev has posted comments on this change. Change subject: aaa: Introducing format to id of User and Group API entities ......................................................................
Patch Set 4: (4 comments) http://gerrit.ovirt.org/#/c/26191/4/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/utils/DirectoryEntryIdUtils.java File backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/utils/DirectoryEntryIdUtils.java: Line 11: public class DirectoryEntryIdUtils { Line 12: Line 13: // ID is in format of "id=<UUID>:provider_name=<string>:<string>" Line 14: private static final Pattern ID_PATTERN = Line 15: Pattern.compile("(id=(?<id>.*))|(providerid=(?<provider>([^:]*):(?<providerid>.*)))"); this is not per what commit comment states, but what I do expect. Line 16: Line 17: /** Line 18: * Gets the internal id part from the id string Line 19: * @param id the id string Line 24: Matcher matcher = ID_PATTERN.matcher(decode(id)); Line 25: if (matcher.matches()) { Line 26: return matcher.group("id"); Line 27: } Line 28: throw new RuntimeException("Error in getting internal id from ID string " + id); please use the exception pattern: if (fail) { throw ... } continue as usual Line 29: } Line 30: Line 31: /** Line 32: * Gets the provider id part from the id string Line 74: * name of directory Line 75: * @param idInDirectory Line 76: * id of entity in directory Line 77: */ Line 78: public static String generateId(Guid internalId) { I think it is confusing to have same function name for two formats usages. Line 79: return encode("id=" + internalId); Line 80: } Line 81: Line 82: private static String decode(String id) { Line 80: } Line 81: Line 82: private static String decode(String id) { Line 83: try { Line 84: return URLDecoder.decode(id, "UTF-8"); please consider remove these wrapper in favour for: URLDecoder.decode(string, Charset.forName("UTF-8")) Line 85: } catch (UnsupportedEncodingException e) { Line 86: throw new RuntimeException(e); Line 87: } Line 88: } -- To view, visit http://gerrit.ovirt.org/26191 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iaecb5d43945769db82475edde1c7075c1a343c07 Gerrit-PatchSet: 4 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com> Gerrit-Reviewer: Barak Azulay <bazu...@redhat.com> Gerrit-Reviewer: Juan Hernandez <juan.hernan...@redhat.com> Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches