[Simple-support] ArrayTransform
Brought to you by:
niallg
|
From: Fabian K. <fab...@we...> - 2009-04-12 14:11:22
|
Hi Group, hi Niall,
(I composed this mail on 06.April, but sent it later)
I just tried to deserialize an *empty* double Array:
@Attribute
public double[] data;
<className data="" />
Now the problem is a
Exception in thread "main" java.lang.NumberFormatException: empty String
What happens is this:
ArrayTransform will first Transform the data to a String array using a
split around ",". This will create the String array { "" } (one empty
String).
Now ArrayTransform will try to convert this to doubles, which fails.
The other way works just fine, an empty double array will be converted
to "".
In my opinion the empty String should be converted to the empty array.
I agree though, that maybe for Strings this is not the perfect Solution.
However, currently new String[] {} and new String[] {""} produce the
same serialization, which can't be desired either.
Fabian
|