aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchibash <chiba@javassist.org>2016-02-12 00:10:20 +0900
committerchibash <chiba@javassist.org>2016-02-12 00:10:20 +0900
commitfee5e033b303efce0cb6d9268b5361d5e1eb1974 (patch)
treed2a9709b790c75d5fd764bcf6c7ceb17e26267e3
parentd4d3ef1dade5d007daeb2f21bc33b065ffe9bfbd (diff)
downloadjavassist-fee5e033b303efce0cb6d9268b5361d5e1eb1974.tar.gz
javassist-fee5e033b303efce0cb6d9268b5361d5e1eb1974.zip
fixes a concurrency bug in ProxyFactory (JASSIST-259)
-rw-r--r--src/main/javassist/util/proxy/ProxyFactory.java11
1 files 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;
}