[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/2fe6d503
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2fe6d503
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2fe6d503

Branch: refs/heads/3.0.x-fixes
Commit: 2fe6d503780983ae7eec9b66bd1d7eda5041cdbd
Parents: e061ffa
Author: Daniel Kulp <[email protected]>
Authored: Mon Oct 12 15:05:36 2015 -0400
Committer: Daniel Kulp <[email protected]>
Committed: Mon Oct 12 15:29:01 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/2fe6d503/rt/wsdl/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
----------------------------------------------------------------------
diff --git a/rt/wsdl/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java 
b/rt/wsdl/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
index f04fb05..75e3ff7 100644
--- a/rt/wsdl/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
+++ b/rt/wsdl/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
@@ -195,6 +195,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,

Reply via email to