[CXF-6632] Fix problem of WSDL's loaded from WSDLManager possibly holding onto themselves strongly and thus resulting in a memory leak.
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/81e728ae Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/81e728ae Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/81e728ae Branch: refs/heads/2.7.x-fixes Commit: 81e728ae0dbcb34557f4fe013c351573bdf020ff Parents: 381a24e Author: Daniel Kulp <[email protected]> Authored: Mon Oct 12 15:05:36 2015 -0400 Committer: Daniel Kulp <[email protected]> Committed: Mon Oct 12 15:32:45 2015 -0400 ---------------------------------------------------------------------- .../src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java | 7 +++++++ 1 file changed, 7 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/81e728ae/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java ---------------------------------------------------------------------- diff --git a/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java b/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java index e294429..4a8d506 100644 --- a/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java +++ b/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java @@ -234,6 +234,13 @@ public class WSDLManagerImpl implements WSDLManager { reader.setFeature("javax.wsdl.verbose", false); reader.setFeature("javax.wsdl.importDocuments", true); reader.setExtensionRegistry(registry); + + //we'll create a new String here to make sure the passed in key is not referenced in the loading of + //the wsdl and thus would be held onto from the cached map from both the weak reference (key) and + //from the strong reference (Definition). For example, the Definition sometimes keeps the original + //string as the documentBaseLocation which would result in it being held onto strongly + //from the definition. With this, the String the definition holds onto would be unique + url = new String(url); CatalogWSDLLocator catLocator = new CatalogWSDLLocator(url, bus); ResourceManagerWSDLLocator wsdlLocator = new ResourceManagerWSDLLocator(url, catLocator,
