Property editor inside an Applet

J

Jean-Marc Vanel

When I attempt to instanciate sun.beans.editors.StringEditor inside an
Applet I get this :

java.security.AccessControlException: access denied
(java.lang.RuntimePermission accessClassInPackage.sun.beans.editors)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPackageAccess(Unknown Source)
at sun.applet.AppletSecurity.checkPackageAccess(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)

Is this normal or a bug?
I run on Windows XP with JDK 1.5.0_01 .

I first tried to do :
PropertyEditor pe = java.beans.PropertyEditorManager.findEditor(
String.class );

which is the normal way to do it , but I got null .
 
J

Jean-Marc Vanel

Jean-Marc Vanel said:
When I attempt to instanciate sun.beans.editors.StringEditor inside an
Applet I get this :

java.security.AccessControlException: access denied
(java.lang.RuntimePermission accessClassInPackage.sun.beans.editors)
at java.security.AccessControlContext.checkPermission(Unknown Source)

Is this normal or a bug?
I run on Windows XP with JDK 1.5.0_01 .

I first tried to do :
PropertyEditor pe = java.beans.PropertyEditorManager.findEditor(
String.class );

which is the normal way to do it , but I got null .

I answer to myself.
I did this in my application. No need to instanciate
sun.beans.editors.StringEditor, PropertyEditorSupport does the job :

PropertyEditor editor = PropertyEditorManager.findEditor(classs);
// ad-hoc to solve problem running inside an Applet - JDK 1.5.0_01
if ( editor == null && classs == String.class ) {
editor = new PropertyEditorSupport();
}

Note: I did these google searches without results :
- reflection applet development beans troubles
- java security applet class loader
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,602
Members
45,185
Latest member
GluceaReviews

Latest Threads

Top