Author: dallen6
Date: 2010-05-03 04:22:14 -0400 (Mon, 03 May 2010)
New Revision: 6210
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java
Log:
Reset state of proxy after serialization is complete
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java 2010-05-03
07:43:13 UTC (rev 6209)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java 2010-05-03
08:22:14 UTC (rev 6210)
@@ -309,7 +309,7 @@
* Adds special serialization code be providing a writeReplace() method on
* the proxy. This method when first called will substitute the proxy
* object with an instance of {@link org.jboss.weld.proxy.util.SerializableProxy}.
- * Subsequent calls will receive the proxy object itself permitting the substitute
+ * The next call will receive the proxy object itself permitting the substitute
* object to serialize the proxy.
*
* @param proxyClassType the Javassist class for the proxy class
@@ -319,13 +319,14 @@
try
{
// Create a two phase writeReplace where the first call uses a
- // replacement object and subsequent calls get the proxy object.
+ // replacement object and the subsequent call get the proxy object.
CtClass exception = classPool.get(ObjectStreamException.class.getName());
CtClass objectClass = classPool.get(Object.class.getName());
String writeReplaceBody = "{ " +
- " if (firstSerializationPhaseComplete)" +
+ " if (firstSerializationPhaseComplete) {" +
+ " firstSerializationPhaseComplete = true; " +
" return $0; " +
- " else {" +
+ " } else {" +
" firstSerializationPhaseComplete = true; " +
" return
((org.jboss.weld.serialization.spi.ProxyServices)org.jboss.weld.Container.instance().services().get(org.jboss.weld.serialization.spi.ProxyServices.class)).wrapForSerialization($0);"
+
" } }";