Hi Peter,

Peter A wrote:

> I spoke too soon.  The code in the previous message works in applications
> and applets as long as it doesn't encounter a class variable that's
> composed of a single letter name.  If it does contain a class variable
> with a single letter then it will work as an application but throw the
> following
> exception inside an applet.  This seems a bit quirky.  I vaguely remember
> needing to modify JavaBeanConverter when i submitted that patch/hack a
> while ago.

This has nothing to do with the JavaBeanConverter or with the name. You can 
see from the stack trace, that georegression.struct.se.Se3_F64 was handled 
by the ReflectionConverter ... which will *never* work in an untrusted 
applet. It simply seems that georegression.struct.se.Se3_F64 is not a 
JavaBean (resp. has no public default constructor).

- Jörg

> 
> - Peter
> 
> Exception in thread "Thread-1"
> com.thoughtworks.xstream.converters.ConversionException: access denied
> ("java.lang.reflect.ReflectPermission" "suppressAccessChecks") : access
> denied ("java.lang.reflect.ReflectPermission" "suppressAccessChecks")
> ---- Debugging information ----
> message             : access denied ("java.lang.reflect.ReflectPermission"
> "suppressAccessChecks")
> cause-exception     : java.security.AccessControlException
> cause-message       : access denied ("java.lang.reflect.ReflectPermission"
> "suppressAccessChecks")
> class               : georegression.struct.se.Se3_F64
> required-type       : georegression.struct.se.Se3_F64
> converter-type      :
> com.thoughtworks.xstream.converters.javabean.JavaBeanConverter
> path                : /boofcv.struct.calib.StereoParameters/rightToLeft/r
> line number         : 31
> class[1]            : boofcv.struct.calib.StereoParameters
> version             : not available
> -------------------------------
>     at
> 
com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
>     at
> 
com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
>     at
> 
com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
>     at
> 
com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
>     at
> 
com.thoughtworks.xstream.converters.javabean.JavaBeanConverter.unmarshal(JavaBeanConverter.java:134)
>     at
> 
com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
>     at
> 
com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
>     at
> 
com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
>     at
> 
com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
>     at
> 
com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
>     at
> 
com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
>     at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1185)
>     at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1169)
>     at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1040)
>     at boofcv.io.UtilIO.loadXML(UtilIO.java:152)
>     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)
> Caused by: java.security.AccessControlException: access denied
> ("java.lang.reflect.ReflectPermission" "suppressAccessChecks")
>     at
> 
java.security.AccessControlContext.checkPermission(AccessControlContext.java:366)
>     at
> java.security.AccessController.checkPermission(AccessController.java:560)
>     at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
>     at
> 
java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:128)
>     at
> 
com.thoughtworks.xstream.converters.reflection.FieldDictionary.buildMap(FieldDictionary.java:148)
>     at
> 
com.thoughtworks.xstream.converters.reflection.FieldDictionary.fieldOrNull(FieldDictionary.java:113)
>     at
> 
com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.getFieldOrNull(PureJavaReflectionProvider.java:193)
>     at
> 
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.canAccess(AbstractReflectionConverter.java:61)
>     at
> 
com.thoughtworks.xstream.converters.reflection.ReflectionConverter.canConvert(ReflectionConverter.java:41)
>     at
> 
com.thoughtworks.xstream.core.DefaultConverterLookup.lookupConverterForType(DefaultConverterLookup.java:56)
>     at
> 
com.thoughtworks.xstream.XStream$1.lookupConverterForType(XStream.java:498)
>     at
> 
com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:56)
>     at
> 
com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
>     at
> 
com.thoughtworks.xstream.converters.javabean.JavaBeanConverter.unmarshal(JavaBeanConverter.java:134)
>     at
> 
com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
>     ... 18 more
> 
> 
> On Wed, Jun 4, 2014 at 12:08 PM, Jörg Schaible
> <[email protected]
>> wrote:
> 
>> Peter A wrote:
>>
>> > 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!
>>
>> Actually the context classloader should do:
>>
>>   Thread.currentThread().getContextClassloader();
>>
>> Cheers,
>> Jörg
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
> 
> 



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to