Author: klape
Date: 2012-04-19 22:16:40 -0400 (Thu, 19 Apr 2012)
New Revision: 16189
Modified:
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/CommonBindingProvider.java
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.java
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/utils/DOMUtils.java
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/utils/ThreadLocalAssociation.java
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws626/ServerHandler.java
Log:
Committing patches [JBWS-1620][JBWS-1833][JBWS-1903] to one-off branch for 1.2.1.GA_CP01
Modified:
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/CommonBindingProvider.java
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/CommonBindingProvider.java 2012-04-19
23:11:28 UTC (rev 16188)
+++
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/CommonBindingProvider.java 2012-04-20
02:16:40 UTC (rev 16189)
@@ -55,6 +55,7 @@
{
this.epMetaData = epMetaData;
initBinding(epMetaData.getBindingId(), epMetaData.getType());
+ this.epMetaData.registerConfigObserver(this);
configure();
}
Modified:
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java 2012-04-19
23:11:28 UTC (rev 16188)
+++
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java 2012-04-20
02:16:40 UTC (rev 16189)
@@ -38,6 +38,7 @@
import javax.xml.ws.wsaddressing.W3CEndpointReference;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.core.utils.DOMUtils;
import org.w3c.dom.Element;
/**
@@ -59,6 +60,7 @@
public ServiceDelegate createServiceDelegate(URL wsdlLocation, QName serviceName,
Class serviceClass)
{
ServiceDelegateImpl delegate = new ServiceDelegateImpl(wsdlLocation, serviceName,
serviceClass);
+ DOMUtils.clearThreadLocals();
return delegate;
}
Modified:
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2012-04-19
23:11:28 UTC (rev 16188)
+++
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2012-04-20
02:16:40 UTC (rev 16189)
@@ -67,6 +67,7 @@
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.core.utils.ThreadLocalAssociation;
+import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData;
@@ -490,6 +491,8 @@
// clear thread local storage
ThreadLocalAssociation.clear();
+
+ DOMUtils.clearThreadLocals();
}
}
Modified:
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.java
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.java 2012-04-19
23:11:28 UTC (rev 16188)
+++
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.java 2012-04-20
02:16:40 UTC (rev 16189)
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.io.PushbackInputStream;
import java.io.UnsupportedEncodingException;
import java.util.Collection;
import java.util.Enumeration;
@@ -89,6 +90,7 @@
String boundaryParameter = contentType.getParameter("boundary");
String start = contentType.getParameter("start");
byte[] boundary;
+ byte[] crlf;
if (boundaryParameter == null)
throw new IllegalArgumentException("multipart/related content type did not
contain a boundary");
@@ -100,13 +102,19 @@
boundary = ("--" +
boundaryParameter).getBytes("US-ASCII");
else
boundary = ("\r\n--" +
boundaryParameter).getBytes("US-ASCII");
+
+ crlf = ("\r\n").getBytes("US-ASCII");
}
catch (UnsupportedEncodingException e)
{
throw new WSException("US-ASCII not supported, this should never
happen");
}
+
+ // [JBWS-1620] - Incorrect handling of MIME boundaries in MultipartRelatedDecoder
+ PushbackInputStream pushBackStream = new PushbackInputStream(stream,2);
+ pushBackStream.unread(crlf);
- BoundaryDelimitedInputStream delimitedStream = new
BoundaryDelimitedInputStream(stream, boundary);
+ BoundaryDelimitedInputStream delimitedStream = new
BoundaryDelimitedInputStream(pushBackStream, boundary);
// Eat first inner stream since its empty
byte[] buffer = new byte[256];
Modified:
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/utils/DOMUtils.java
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/utils/DOMUtils.java 2012-04-19
23:11:28 UTC (rev 16188)
+++
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/utils/DOMUtils.java 2012-04-20
02:16:40 UTC (rev 16189)
@@ -93,6 +93,12 @@
{
}
+ public static void clearThreadLocals()
+ {
+ documentThreadLocal.remove();
+ builderThreadLocal.remove();
+ }
+
/** Initialise the the DocumentBuilder
*/
public static DocumentBuilder getDocumentBuilder()
Modified:
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/utils/ThreadLocalAssociation.java
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/utils/ThreadLocalAssociation.java 2012-04-19
23:11:28 UTC (rev 16188)
+++
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/core/utils/ThreadLocalAssociation.java 2012-04-20
02:16:40 UTC (rev 16189)
@@ -71,8 +71,8 @@
public static void clear()
{
- invokerMDBAssoc.set(null);
- msgContextAssoc.set(null);
- strTransformAssoc.set(null);
+ invokerMDBAssoc.remove();
+ msgContextAssoc.remove();
+ strTransformAssoc.remove();
}
}
Modified:
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2012-04-19
23:11:28 UTC (rev 16188)
+++
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-core/src/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2012-04-20
02:16:40 UTC (rev 16189)
@@ -52,6 +52,8 @@
import java.lang.reflect.Method;
import java.util.*;
+import java.lang.ref.WeakReference;
+
/**
* A Service component describes a set of endpoints.
*
@@ -604,9 +606,6 @@
if (config == null)
initEndpointConfig();
- // register any configurable with the ConfigProvider
- configObservable.addObserver(configurable);
-
// SOAPBinding configuration
if (configurable instanceof CommonBindingProvider)
{
@@ -715,11 +714,51 @@
class ConfigObservable extends Observable
{
+
+ private List<WeakReference<Observer>> observer = new
ArrayList<WeakReference<Observer>>();
+
public void doNotify(Object object)
{
setChanged();
notifyObservers(object);
}
+
+ public synchronized void addObserver(Observer o)
+ {
+ observer.add( new WeakReference(o));
+ }
+
+ public synchronized void deleteObserver(Observer o)
+ {
+ for(WeakReference<Observer> w : observer)
+ {
+ Observer tmp = w.get();
+ if(tmp.equals(o))
+ {
+ observer.remove(o);
+ break;
+ }
+
+ }
+ }
+
+ public void notifyObservers()
+ {
+ notifyObservers(null);
+ }
+
+ public void notifyObservers(Object arg)
+ {
+ if(hasChanged())
+ {
+ for(WeakReference<Observer> w : observer)
+ {
+ Observer tmp = w.get();
+ tmp.update(this, arg);
+
+ }
+ }
+ }
}
public List<UnifiedPortComponentRefMetaData> getServiceRefContrib()
Modified:
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws626/ServerHandler.java
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws626/ServerHandler.java 2012-04-19
23:11:28 UTC (rev 16188)
+++
legacy/branches/jbossws-1.2.1.GA_CP01_JBPAPP-8570/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws626/ServerHandler.java 2012-04-20
02:16:40 UTC (rev 16189)
@@ -21,6 +21,8 @@
*/
package org.jboss.test.ws.jaxrpc.jbws626;
+import org.jboss.ws.core.CommonMessageContext;
+
import java.util.Iterator;
import javax.xml.namespace.QName;
@@ -83,6 +85,10 @@
wasName = soapElement.getElementName();
assertElementName(expName, wasName);
}
+
+ // for testing the CommonBindingProvider memory leak. Not related to this
test...
+ ((CommonMessageContext)msgContext).setModified(true);
+
}
catch (SOAPException ex)
{
Show replies by date