mirror of https://github.com/apache/openjpa.git
OPENJPA-1470 Java 2 Security permission violation on getClassLoader caused JEE container unable to enhance entities on the fly.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@900905 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3bff964503
commit
968634a738
|
@ -495,23 +495,24 @@ public class PCEnhancer {
|
||||||
* @return <code>ENHANCE_*</code> constant
|
* @return <code>ENHANCE_*</code> constant
|
||||||
*/
|
*/
|
||||||
public int run() {
|
public int run() {
|
||||||
|
Class<?> type = _managedType.getType();
|
||||||
try {
|
try {
|
||||||
// if managed interface, skip
|
// if managed interface, skip
|
||||||
if (_pc.isInterface())
|
if (_pc.isInterface())
|
||||||
return ENHANCE_INTERFACE;
|
return ENHANCE_INTERFACE;
|
||||||
|
|
||||||
// check if already enhanced
|
// check if already enhanced
|
||||||
ClassLoader loader = _managedType.getType().getClassLoader();
|
ClassLoader loader = AccessController.doPrivileged(J2DoPrivHelper.getClassLoaderAction(type));
|
||||||
for (Class<?> iface : _managedType.getDeclaredInterfaceTypes()) {
|
for (Class<?> iface : _managedType.getDeclaredInterfaceTypes()) {
|
||||||
if (iface.getName().equals(PCTYPE.getName())) {
|
if (iface.getName().equals(PCTYPE.getName())) {
|
||||||
if (_log.isTraceEnabled()) {
|
if (_log.isTraceEnabled()) {
|
||||||
_log.trace(_loc.get("pc-type", _managedType.getType(), loader));
|
_log.trace(_loc.get("pc-type", type, loader));
|
||||||
}
|
}
|
||||||
return ENHANCE_NONE;
|
return ENHANCE_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_log.isTraceEnabled()) {
|
if (_log.isTraceEnabled()) {
|
||||||
_log.trace(_loc.get("enhance-start", _managedType.getType(), loader));
|
_log.trace(_loc.get("enhance-start", type, loader));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -541,13 +542,13 @@ public class PCEnhancer {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_log.isWarnEnabled())
|
if (_log.isWarnEnabled())
|
||||||
_log.warn(_loc.get("pers-aware", _managedType.getType(), loader));
|
_log.warn(_loc.get("pers-aware", type, loader));
|
||||||
return ENHANCE_AWARE;
|
return ENHANCE_AWARE;
|
||||||
} catch (OpenJPAException ke) {
|
} catch (OpenJPAException ke) {
|
||||||
throw ke;
|
throw ke;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new GeneralException(_loc.get("enhance-error",
|
throw new GeneralException(_loc.get("enhance-error",
|
||||||
_managedType.getType().getName(), e.getMessage()), e);
|
type.getName(), e.getMessage()), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue