Permalink
Browse files

Fix bug where non-accessible field is briefly published, causing hide…

…ous random exceptions
  • Loading branch information...
1 parent a4fb0d5 commit 4dce7ffbff4475b852ad935f9a3a3daf35ecffcb @dmlloyd dmlloyd committed Apr 21, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/main/java/org/jboss/invocation/proxy/ProxyFactory.java
View
5 src/main/java/org/jboss/invocation/proxy/ProxyFactory.java
@@ -373,8 +373,9 @@ private Field getInvocationHandlerField() {
synchronized (this) {
if (invocationHandlerField == null) {
try {
- invocationHandlerField = defineClass().getDeclaredField(INVOCATION_HANDLER_FIELD);
- AccessController.doPrivileged(new SetAccessiblePrivilege(invocationHandlerField));
+ final Field field = defineClass().getDeclaredField(INVOCATION_HANDLER_FIELD);
+ AccessController.doPrivileged(new SetAccessiblePrivilege(field));
+ invocationHandlerField = field;
} catch (NoSuchFieldException e) {
throw new RuntimeException("Could not find invocation handler on generated proxy", e);
}

0 comments on commit 4dce7ff

Please sign in to comment.