From fee5e033b303efce0cb6d9268b5361d5e1eb1974 Mon Sep 17 00:00:00 2001 From: chibash Date: Fri, 12 Feb 2016 00:10:20 +0900 Subject: [PATCH] fixes a concurrency bug in ProxyFactory (JASSIST-259) --- src/main/javassist/util/proxy/ProxyFactory.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/javassist/util/proxy/ProxyFactory.java b/src/main/javassist/util/proxy/ProxyFactory.java index e6a773f5..5251b4be 100644 --- a/src/main/javassist/util/proxy/ProxyFactory.java +++ b/src/main/javassist/util/proxy/ProxyFactory.java @@ -421,20 +421,21 @@ public class ProxyFactory { } private Class createClass1() { - if (thisClass == null) { + Class result = thisClass; + if (result == null) { ClassLoader cl = getClassLoader(); synchronized (proxyCache) { if (factoryUseCache) createClass2(cl); else createClass3(cl); + + result = thisClass; + // don't retain any unwanted references + thisClass = null; } } - // don't retain any unwanted references - Class result = thisClass; - thisClass = null; - return result; } -- 2.39.5