Re: [Simple-support] Exception with simple test
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2007-12-02 16:35:22
|
Hi,
It should be "public static class" for Item, rather
than "public class", currently I have not implemented
not-static innerclass instantiation as it requires
instantiation of the outer class.
Niall
--- Frank Castellucci <fra...@gm...> wrote:
> ===========
> Here is the xml:
> ===========
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <navtree name="AddCustomer">
> <items>
> <item name="General"
> content="/customer/ccw/general.zul"/>
> <item name="ISY Setup"
> content="/customer/ccw/isysetup.zul"/>
> <item name="Floorplan"
> content="/customer/ccw/floorplan.zul"/>
> <item name="Complete"
> content="/customer/ccw/completed.zul"/>
> </items>
> </navtree>
>
> ================
> Here is the java class:
> ================
>
> package org.fvjc.udservice.ui;
>
> import java.util.List;
> import java.util.ArrayList;
> import org.simpleframework.xml.*;
> /**
> * @author frank
> *
> */
>
> @Root(name="navtree")
> public class WizardItems
> {
> @Attribute(name="name")
> private String name;
>
> @ElementList(name="items")
> private List<Item> list;
>
>
> @Root(name="item")
> public class Item
> {
> @Attribute
> private String name;
> @Attribute
> private String content;
>
> public Item()
> {
>
> }
>
> public Item(String name, String content)
> {
> this.name = name;
> this.content = content;
> }
> /**
> * @return the name
> */
> public String getName()
> {
> return name;
> }
> /**
> * @return the content
> */
> public String getContent()
> {
> return content;
> }
>
> }
>
> public WizardItems()
> {
>
> }
>
> public WizardItems(String name)
> {
> super();
> this.name = name;
> }
> /**
> * @param name
> * @param list
> */
> public WizardItems(String name, List<Item> list)
> {
> super();
> this.name = name;
> this.list = list;
> }
>
> public String getName()
> {
> return name;
> }
>
> public List<Item> getItems()
> {
> return list;
> }
>
> }
>
> ================
> Here is the invocation:
> ================
> Persister ser = new Persister();
> File example = new File(Sessions.getCurrent
> ().getWebApp().getRealPath(arg0));
> try
> {
> final WizardItems wizItems =
> ser.read(WizardItems.class,
> example);
> if(wizItems != null)
> {
>
> }
> }
> catch (Exception e)
> {
> e.printStackTrace();
> }
>
> ===================
> And here is the exception
> ===================
> java.lang.NoSuchMethodException:
> org.fvjc.udservice.ui.WizardItems$Item
> .<init>()
> at java.lang.Class.getConstructor0(Unknown
> Source)
> at
> java.lang.Class.getDeclaredConstructor(Unknown
> Source)
> at
>
org.simpleframework.xml.load.ClassType.getInstance(ClassType.java:88)
> at
>
org.simpleframework.xml.load.ClassType.getInstance(ClassType.java:72)
> at
>
org.simpleframework.xml.load.Composite.read(Composite.java:113)
> at
>
org.simpleframework.xml.load.Traverser.read(Traverser.java:72)
> at
>
org.simpleframework.xml.load.CompositeList.read(CompositeList.java
> :134)
> at
>
org.simpleframework.xml.load.CompositeList.read(CompositeList.java
> :108)
> at
>
org.simpleframework.xml.load.Composite.read(Composite.java:355)
> at
>
org.simpleframework.xml.load.Composite.readElement(Composite.java
> :334)
> at
>
org.simpleframework.xml.load.Composite.readElements(Composite.java
> :250)
> at
>
org.simpleframework.xml.load.Composite.read(Composite.java:194)
> at
>
org.simpleframework.xml.load.Composite.read(Composite.java:140)
> at
>
org.simpleframework.xml.load.Composite.read(Composite.java:116)
> at
>
org.simpleframework.xml.load.Traverser.read(Traverser.java:72)
> at
>
org.simpleframework.xml.load.Persister.read(Persister.java:392)
> at
>
org.simpleframework.xml.load.Persister.read(Persister.java:374)
> at
>
org.simpleframework.xml.load.Persister.read(Persister.java:355)
> at
>
org.simpleframework.xml.load.Persister.read(Persister.java:337)
> at
>
org.simpleframework.xml.load.Persister.read(Persister.java:319)
> at
>
org.simpleframework.xml.load.Persister.read(Persister.java:300)
> at
>
org.simpleframework.xml.load.Persister.read(Persister.java:279)
> at
>
org.fvjc.udservice.ui.Wizard.setConfig(Wizard.java:169)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
> Source)
> at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> Source)
> at java.lang.reflect.Method.invoke(Unknown
> Source)
> at
>
org.zkoss.zk.ui.metainfo.Property.assign(Property.java:187)
>
=== message truncated ===>
-------------------------------------------------------------------------
> SF.Net email is sponsored by: The Future of Linux
> Business White Paper
> from Novell. From the desktop to the data center,
> Linux is going
> mainstream. Let it simplify your IT future.
>
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4>
_______________________________________________
> Simple-support mailing list
> Sim...@li...
>
https://lists.sourceforge.net/lists/listinfo/simple-support
>
____________________________________________________________________________________
Get easy, one-click access to your favorites.
Make Yahoo! your homepage.
http://www.yahoo.com/r/hs
|