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 2013/02/13 18:09:33 UTC

svn commit: r1445750 - /cxf/branches/2.5.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java

Author: dkulp
Date: Wed Feb 13 17:09:33 2013
New Revision: 1445750

URL: http://svn.apache.org/r1445750
Log:
Merged revisions 1445730 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes

........
  r1445730 | dkulp | 2013-02-13 11:48:42 -0500 (Wed, 13 Feb 2013) | 18 lines

  Merged revisions 1445378 via  git cherry-pick from
  https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes

  ........
    r1445378 | dkulp | 2013-02-12 16:16:13 -0500 (Tue, 12 Feb 2013) | 10 lines

    Merged revisions 1445284 via  git cherry-pick from
    https://svn.apache.org/repos/asf/cxf/trunk

    ........
      r1445284 | dkulp | 2013-02-12 12:30:20 -0500 (Tue, 12 Feb 2013) | 2 lines

      If the DescriptionInfo doesn't have a baseURI, create one to avoid policy fragments poluting from one wsdl to another.

    ........

  ........

........

Modified:
    cxf/branches/2.5.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java

Modified: cxf/branches/2.5.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java?rev=1445750&r1=1445749&r2=1445750&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java (original)
+++ cxf/branches/2.5.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java Wed Feb 13 17:09:33 2013
@@ -189,7 +189,11 @@ public class Wsdl11AttachmentPolicyProvi
                             Policy policy = builder.getPolicy(e.getElement());
                             String fragement = "#" + uri;
                             registry.register(fragement, policy);
-                            registry.register(di.getBaseURI() + fragement, policy);
+                            if (di.getBaseURI() == null) {
+                                registry.register(Integer.toString(di.hashCode()) + fragement, policy);
+                            } else {
+                                registry.register(di.getBaseURI() + fragement, policy);
+                            }
                         } catch (Exception policyEx) {
                             //ignore the policy can not be built
                             LOG.warning("Failed to build the policy '" + uri + "':" + policyEx.getMessage());
@@ -259,7 +263,11 @@ public class Wsdl11AttachmentPolicyProvi
     Policy resolveReference(PolicyReference ref, DescriptionInfo di) {
         Policy p = null;
         if (isExternal(ref)) {
-            p = resolveExternal(ref, di.getBaseURI());
+            String uri = di.getBaseURI();
+            if (uri == null) {
+                uri = Integer.toString(di.hashCode());
+            }
+            p = resolveExternal(ref, uri);
         } else {
             p = resolveLocal(ref, di);
         }
@@ -269,7 +277,12 @@ public class Wsdl11AttachmentPolicyProvi
     
     Policy resolveLocal(PolicyReference ref, DescriptionInfo di) {
         String uri = ref.getURI().substring(1);
-        String absoluteURI = di.getBaseURI() + ref.getURI();
+        String absoluteURI = di.getBaseURI();
+        if (absoluteURI == null) {
+            absoluteURI = Integer.toString(di.hashCode()) + ref.getURI();
+        } else {
+            absoluteURI = absoluteURI + ref.getURI();
+        }
         Policy resolved = registry.lookup(absoluteURI);
         if (null != resolved) {
             return resolved;