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 -----------------------
com.thoughtworks.xstream.converters.ConversionException: No converter
specified for class org.ejml.data.DenseMatrix64F
---- Debugging information ----
-------------------------------
at
com.thoughtworks.xstream.core.DefaultConverterLookup.lookupConverterForType(DefaultConverterLookup.java:61)
at
com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:48)
at
com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
at
com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
at
com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
at com.thoughtworks.xstream.XStream.marshal(XStream.java:990)
at com.thoughtworks.xstream.XStream.marshal(XStream.java:979)
at com.thoughtworks.xstream.XStream.toXML(XStream.java:967)
at boofcv.misc.BoofMiscOps.saveXML(BoofMiscOps.java:49)
at
boofcv.misc.TestBoofMiscOps.saveXML_loadXML_file(TestBoofMiscOps.java:42)
On Thu, Jul 4, 2013 at 12:45 PM, Jörg Schaible <[email protected]>wrote:
> Hi Peter,
>
> Peter A wrote:
>
> > Hi Jörg,
> >
> > I see that you posted a fix. Skimming through the code it looks like it
> > should work. Just need to pass in a ClassLoaderReference with the
> > ClassLoader set to null right?
>
> Actually I thought that you will pass a ClassLoader from a class that is
> already loaded, e.g. "new XStream(new
> ClassLoaderReference(getClass().getClassLoader()))". Setting the reference
> to null will currently raise NPEs, but I will have a look if I can use then
> the bootstrap class loader instead (see Javadoc for Class.loadClass(,,)).
>
> > There is also another bug that I need to report. I *think* with the
> > JavaBeanConverter (if not that class then another one does) it mangles
> the
> > case of single character variables. So 'R' becomes 'r' breaking
> > compatibility with other converters. When I test your patch I'll submit
> > the formal bug report.
>
> Fine.
>
> Note, that I have nothing done yet regarding the initialization errors for
> the converters. I have the intent to do so, but you may open a separate
> JIRA
> issue.
>
> Regards,
> Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
--
"Now, now my good man, this is no time for making enemies." — Voltaire
(1694-1778), on his deathbed in response to a priest asking that he
renounce Satan.