Re: [Simple-support] Bug in scattered inlined elements
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2007-12-13 20:31:53
|
Hi,
I have just released version 1.6.1. The bug with
scattered elements has been resolved. Now all values
are set only after they have been fully read.
Niall
--- Filip Perlhagen <fil...@ev...>
wrote:
> Bug in scattered inlined elements:
> When using scattered inlined elements, the set(List
> list) method is called once only containing the
> first Element that is found. See the below test
> case:
>
> Possible fix: Call the set(List list) method only
> after alla element in the list has been added.
>
>
> import java.util.LinkedList;
> import java.util.List;
> import org.simpleframework.xml.Element;
> import org.simpleframework.xml.ElementList;
> import org.simpleframework.xml.Root;
> import org.simpleframework.xml.load.Persister;
>
> @Root(name="t")
> public class InlinePrimitiveList {
> public static boolean showBug;
>
> @Element String name;
> private List<String> data = new
> LinkedList<String>();
>
> @ElementList(inline=true)
> void setList(List<String> list) {
> if(showBug) {
> data = new LinkedList(list);
> } else {
> data = list;
> }
> }
>
> @ElementList(inline=true)
> List<String> getList() {
> return data;
> }
>
> public String toString() {
> return " name: " + name + " " + data;
> }
>
> public static void main(String[] args) throws
> Exception {
> showBug = false;
> test();
> showBug = true;
> test();
> }
>
> private static void test() throws Exception {
> System.out.println("Object: " + new
> Persister().read(InlinePrimitiveList.class,
>
"<t><string>1</string><name>a</name><string>2</string></t>"));
> }
>
> }
>
>
>
> /Filip Perlhagen
> >
-------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php>
_______________________________________________
> Simple-support mailing list
> Sim...@li...
>
https://lists.sourceforge.net/lists/listinfo/simple-support
>
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
|