You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2012/10/25 18:17:41 UTC

svn commit: r1402205 - /cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java

Author: dkulp
Date: Thu Oct 25 16:17:40 2012
New Revision: 1402205

URL: http://svn.apache.org/viewvc?rev=1402205&view=rev
Log:
Restore the saving of the URL as its required for the caching to work properly.
Put a comment to that affect.

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java?rev=1402205&r1=1402204&r2=1402205&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java Thu Oct 25 16:17:40 2012
@@ -168,13 +168,25 @@ public class WSDLManagerImpl implements 
     public Definition getDefinition(URL url) throws WSDLException { 
         String urlString = url.toString();
         synchronized (definitionsMap) {
+            //This needs to use the exact URL object for the cache
+            //as the urlString object is not held onto strongly
+            //and thus, could cause the definition to be garbage
+            //collected.
+            if (definitionsMap.containsKey(url)) {
+                return definitionsMap.get(url);
+            }
             if (definitionsMap.containsKey(urlString)) {
                 return definitionsMap.get(urlString);
             }
         }
         Definition def = loadDefinition(urlString);
         synchronized (definitionsMap) {
-            definitionsMap.put(urlString, def);
+            //see note about about the url
+            //The loadDefinition call will add it with the
+            //string form, we just need to add it with the 
+            //url form (which Sonar will complain about,
+            //but we need to do it)
+            definitionsMap.put(url, def);
         }
         return def;
     }