Ok here is what worked successfully inside an applet:
---------------------- BEGIN ----------------------------
XStream xstream = new XStream(new PureJavaReflectionProvider(),new
XppDriver(),
new ClassLoaderReference(UtilIO.class.getClassLoader()));
xstream.registerConverter(new
JavaBeanConverter(xstream.getMapper()));
----------------------- END -----------------------------
Where UtilIO is just a random class in my code. At one point I made the
mistake of passing in Reader.class which caused weird class not found
exceptions to be thrown.
I would recommend adding that somewhere to the tutorial since the default
doesn't work in Applets. Thanks again for the help!
- Peter
On Tue, Jun 3, 2014 at 6:12 PM, Jörg Schaible <[email protected]> wrote:
> Hi Peter,
>
> Peter A wrote:
>
> > Here's the full message. Works just fine when run as an application:
> >
> > /opt/jdk/jdk1.7.0_45/bin/appletviewer index.html
> > Exception in thread "Thread-1" java.security.AccessControlException:
> > access denied ("java.lang.RuntimePermission" "createClassLoader")
>
>
> You will never have this permission in an unsigned applet.
>
>
> > at
> >
>
> java.security.AccessControlContext.checkPermission(AccessControlContext.java:372)
> > at
> > java.security.AccessController.checkPermission(AccessController.java:559)
> > at
> java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
> > at
> >
> java.lang.SecurityManager.checkCreateClassLoader(SecurityManager.java:611)
> > at java.lang.ClassLoader.checkCreateClassLoader(ClassLoader.java:275)
> > at java.lang.ClassLoader.<init>(ClassLoader.java:336)
> > at
> >
>
> com.thoughtworks.xstream.core.util.CompositeClassLoader.<init>(CompositeClassLoader.java:73)
> > at com.thoughtworks.xstream.XStream.<init>(XStream.java:411)
> > at com.thoughtworks.xstream.XStream.<init>(XStream.java:364)
>
>
> You have to provide the classloader in a ClassLoaderReference also as
> XStream contructor parameter.
>
>
> > at boofcv.io.UtilIO.loadXML(UtilIO.java:154)
> > at
> >
>
> boofcv.alg.geo.rectify.ShowRectifyCalibratedApp.changeInput(ShowRectifyCalibratedApp.java:154)
> > at
> >
>
> boofcv.gui.SelectAlgorithmAndInputPanel.performChangeInput(SelectAlgorithmAndInputPanel.java:326)
> > at
> >
>
> boofcv.gui.SelectAlgorithmAndInputPanel.access$200(SelectAlgorithmAndInputPanel.java:44)
> > at
> >
>
> boofcv.gui.SelectAlgorithmAndInputPanel$8.run(SelectAlgorithmAndInputPanel.java:300)
> >
> > The code right now is slightly different from the way it was before:
> >
> > public static <T> T loadXML( Reader r ) {
> > XStream xstream = new XStream(new PureJavaReflectionProvider());
> > xstream.registerConverter(new
> > JavaBeanConverter(xstream.getMapper()));
> > return (T)xstream.fromXML(r);
> > }
> >
> > Another issue I have now is that the PureJavaReflectionProvider() has
> > issues with capitalization.
>
>
> Sorry, no. The PureJavaReflectonProvider has no such issues.
>
>
> > The variable is capitalized in the class but
> > I have to modify the xml by hand to make it lower case or it won't parse.
>
>
> Since you have registered to use a JavaBeanConverter for any class with a
> public default constructor.
>
> =================== %< =============
> XStream xstream = new XStream(new PureJavaReflectionProvider());
> xstream.registerConverter(new JavaBeanConverter(xstream.getMapper()));
> ConverterLookup lookup = xstream.getConverterLookup();
> assertTrue(lookup.lookupConverterForType(ArrayList.class) instanceof
> =================== %< =============
>
> The priority of the internally registered converters is listed here:
> http://xstream.codehaus.org/converters.html
>
> The JavaBeanConverter is not using the PureJavaReflectionConverter at all,
> it follows the JavaBean naming conventions:
>
> =================== %< =============
> class Bean {
> String __NaMe$$;
> String getName() { return __NaMe$$; }
> void setName(String s) { __NaMe$$ = s; }
> }
> =================== %< =============
>
> Since the bean attribute's name is "name", "name" will be used for the XML
> elements in a Bean instance. Register the converter with a lower prio.
>
>
> > I also have more time now and should be able to reply faster. Sorry for
> > the previous delays.
>
>
> Your feedback is welcome,
> 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.