Peter A wrote:
> Hi Jörg,
>
> When I skimmed the code I thought it handled the null case, must have read
> the code in correctly. Please ignore that comment.
>
> My first attempt to use the new code failed and throws an exception. See
> below for my code. Did I do something wrong?
>
> ---------------- BEGIN -----------------------
> ClassLoaderReference loader = new
> ClassLoaderReference(BoofMiscOps.class.getClassLoader());
> XStream xstream = new XStream(new PureJavaReflectionProvider(),new
> DomDriver(),loader,null,new DefaultConverterLookup(), null);
>
> xstream.registerConverter(new JavaBeanConverter(xstream.getMapper()));
>
> try {
> xstream.toXML(o,new FileOutputStream(fileName));
> } catch (FileNotFoundException e) {
> throw new RuntimeException(e);
> }
> ---------------- END -----------------------
You did not provide a ConverterRegistry, so no converter was registered at
all. Since you use the defaults anyway, simply instantiate with:
XStream xstream = new XStream(new PureJavaReflectionProvider(),new
DomDriver(),loader);
Cheers,
Jörg
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email