directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Radovan Semancik <radovan.seman...@evolveum.com>
Subject Binary values and humanRedable flag
Date Mon, 10 Aug 2015 09:47:36 GMT
Hi,

I'm not 100% sure about this, but it looks like that the API makes 
assumption that all human-readable values will be strings (e.g. in 
DefaultAttribute.add(...) method). I wonder whether this is correct. 
E.g. OpenLDAP and OpenDJ have this definition for jpegPhoto:

attributeTypes: ( 0.9.2342.19200300.100.1.60 NAME 'jpegPhoto' DESC 
'RFC2798: a
   JPEG image' SYNTAX 1.3.6.1.4.1.1466.115.121.1.28 )

There are is no explicit human readable flag, so the API parses this a 
humanReadable attribute syntax.

But then jpegPhoto is obviously binary. When I try to modify it with 
BinaryValue it ends up with:
ERROR (o.a.d.api.ldap.model.entry.DefaultAttribute): ERR_04451 The value 
must be a String, as its AttributeType is H/R
I'm doing the equivalent of attribute.add(new BinaryValue(bytes));

Am I doing something wrong?

And one related remark. The add( Value<?>... vals ) method in 
DefaultAttribute is not very convenient to use and still keep a good 
error reporting. E.g. in the above case it will not throw any error, 
just returns zero. This is enough to detect that there was an error (not 
very convenient though). But the reason why the attribute cannot be 
added is lost. I cannot report back to the higher layers anything better 
than "failed to add foo to bar". But the user will not know what was the 
reason.

-- 
Radovan Semancik
Software Architect
evolveum.com


Mime
View raw message