On 22/10/12 10:07, Dave Reynolds wrote:
On 20/10/12 18:18, Andy Seaborne wrote:
TestTypedLiterals has the following test:
--------
public void testBinary() {
// Check byte[] maps onto a binary type
byte[] data = new byte[]{12, 42, 99};
Literal l = m.createTypedLiteral(data);
LiteralLabel ll = l.asNode().getLiteral();
assertEquals("binary test 1",
ll.getDatatype(),
XSDDatatype.XSDbase64Binary); <<--***********
assertEquals("binary test 2", "DCpj", ll.getLexicalForm());
...
--------
Is it just luck that this has been passing?
no
becase there are two
datatypes that represent binary values: XSDbase64Binary and XSDhexBinary.
True but only one (base64Binary) is registered as the default
serialization for byte[].
This is currently done as the second argument to "super" in the
constructor.
OK, thanks - I broke that and have now unbroken it.
Andy
public XSDbase64Binary(String typeName) {
super(typeName, byte[].class);
}
as opposed to
public XSDhexBinary(String typeName) {
super(typeName, null);
}
Dave