hi doug,
On 7/29/05, McComsey, Doug <[EMAIL PROTECTED]> wrote:
> The testEmptyMultiStringParent test in the TCK looks like this:
>
> public void testEmptyMultiStringParent() throws RepositoryException {
> String[] emptyStringArray = new String[]{null};
> property2.setValue(emptyStringArray);
> node.save();
>
> assertEquals("Property.setValue(emptyStringArray) did not set the
> property to an empty array",
> 0, property2.getValues().length);
> }
>
> This test would make sense if emptyStringArray had been defined this way:
>
> String[] emptyStringArray = new String[0];
>
> As it is defined, it is not an empty array. It has one value, a null, and a
> length of one. My implementation fails this test because it returns exactly
> what was given to it. Zero does not equal one.
>
> Is the test wrong or should I be checking the content of the array and
> removing nulls?
yes, you should be removing nulls. please check "4.7.3 No Null Values"
of the spec:
<quote>
...
In the case of multi-value properties, the setting of a particular
value within the array
to null results in the removal of that value and the compacting of the array.
...
</quote>
cheers
stefan
>
> Regards,
> Doug
>
> Doug McComsey
> Computer Associates
> [EMAIL PROTECTED]
>
>
>