cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1402205 - /cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
Date Thu, 25 Oct 2012 16:17:41 GMT
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;
     }



Mime
View raw message