Yair Zaslavsky has posted comments on this change.

Change subject: aaa: Introducing changes to API (at domain groups/ids)
......................................................................


Patch Set 12:

(1 comment)

http://gerrit.ovirt.org/#/c/26191/12/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/AbstractBackendBaseTest.java
File 
backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/AbstractBackendBaseTest.java:

Line 65:     /**
Line 66:      * External identifiers used by directory users and groups.
Line 67:      */
Line 68:     protected static final String[] EXTERNAL_IDS = {
Line 69:             
DatatypeConverter.printHexBinary(GUIDS[0].toString().getBytes(Charset.forName("UTF-8"))),
> I do not understand this comment.
Ok,
When i wrote this code, I was in a dilemma whether to have it the way suggested 
here, or the way you provided in patchset 13 - 
printHexBinary(Guids[1].toByteArray()) for example.
I chose this way, as if for example we take a guid 
457e2553-2e86-4169-9365-81ab022911f7 I would like to encode all the bytes 
representing every character in the string, including the '-' characters. 
Whereas Guid.toByteArray does not return this.

If I decode this, I will not get a string containing the guid.

You can try: 
 Guid guid = Guid.newGuid();
        System.out.println(new 
String(DatatypeConverter.parseHexBinary(DatatypeConverter.printHexBinary(guid.toByteArray())),
                Charset.forName("UTF-8")));


VS:

 Guid guid = Guid.newGuid();
        System.out.println(new 
String(DatatypeConverter.parseHexBinary(DatatypeConverter.printHexBinary(guid.toString()
                .getBytes(Charset.forName("UTF-8")))),
                Charset.forName("UTF-8")));

In the 2nd example you will get a string that looks like guid printed, in the 
first one - you won't get such a string.

Since the REST-API code encodes all strings in the same way as in 2nd example 
(that is - guid is get translated to String, and then "getBytes" is used on 
this string) I wanted to mimic this behavior here.
Line 70:             
DatatypeConverter.printHexBinary(GUIDS[1].toString().getBytes(Charset.forName("UTF-8"))),
Line 71:             
DatatypeConverter.printHexBinary(GUIDS[2].toString().getBytes(Charset.forName("UTF-8"))),
Line 72:     };
Line 73: 


-- 
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: 12
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

Reply via email to