# HG changeset patch # Parent c3025e1f8f3ecfdad0958492ca39468e2c05a2cf RT-23510 ClassNotFoundException in BeanAdapter over WebStart diff -r c3025e1f8f3e javafx-fxml/src/com/sun/javafx/fxml/BeanAdapter.java --- a/javafx-fxml/src/com/sun/javafx/fxml/BeanAdapter.java Wed Dec 19 12:52:28 2012 +0100 +++ b/javafx-fxml/src/com/sun/javafx/fxml/BeanAdapter.java Thu Dec 20 15:16:02 2012 +0100 @@ -44,6 +44,7 @@ import java.lang.reflect.*; import javafx.beans.value.ObservableValue; +import sun.reflect.misc.ReflectUtil; /** * Exposes Java Bean properties of an object via the {@link Map} interface. @@ -55,6 +56,8 @@ public class BeanAdapter extends AbstractMap { private Object bean; + private static ClassLoader contextClassLoader; + private static HashMap, HashMap>> globalMethodCache = new HashMap, HashMap>>(); @@ -64,7 +67,14 @@ public static final String PROPERTY_SUFFIX = "Property"; public static final String VALUE_OF_METHOD_NAME = "valueOf"; + + static { + contextClassLoader = Thread.currentThread().getContextClassLoader(); + if (contextClassLoader == null) { + contextClassLoader = ClassLoader.getSystemClassLoader(); + } + } /** * Creates a new Bean adapter. * @@ -447,8 +457,12 @@ coercedValue = new BigDecimal(value.toString()); } } else if (type == Class.class) { - try { - coercedValue = Class.forName(value.toString()); + try { + ReflectUtil.checkPackageAccess(value.toString()); + coercedValue = Class.forName( + value.toString(), + false, + BeanAdapter.contextClassLoader); } catch (ClassNotFoundException exception) { throw new IllegalArgumentException(exception); }