You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2016/02/28 15:24:08 UTC

svn commit: r1732737 - in /webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin: AxiomSOAP11FaultSupport.aj AxiomSOAP12FaultSupport.aj AxiomSOAPElementSupport.aj

Author: veithen
Date: Sun Feb 28 14:24:08 2016
New Revision: 1732737

URL: http://svn.apache.org/viewvc?rev=1732737&view=rev
Log:
Use a smarter way to detect SOAP version mismatches.

Modified:
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP11FaultSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAPElementSupport.aj

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP11FaultSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP11FaultSupport.aj?rev=1732737&r1=1732736&r2=1732737&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP11FaultSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP11FaultSupport.aj Sun Feb 28 14:24:08 2016
@@ -27,10 +27,6 @@ import org.apache.axiom.soap.SOAPFaultRe
 import org.apache.axiom.soap.SOAPFaultRole;
 import org.apache.axiom.soap.SOAPProcessingException;
 import org.apache.axiom.soap.impl.intf.AxiomSOAP11Fault;
-import org.apache.axiom.soap.impl.intf.AxiomSOAP11FaultCode;
-import org.apache.axiom.soap.impl.intf.AxiomSOAP11FaultDetail;
-import org.apache.axiom.soap.impl.intf.AxiomSOAP11FaultReason;
-import org.apache.axiom.soap.impl.intf.AxiomSOAP11FaultRole;
 
 public aspect AxiomSOAP11FaultSupport {
     private static final Class<?>[] sequence = { SOAPFaultCode.class, SOAPFaultReason.class,
@@ -42,20 +38,10 @@ public aspect AxiomSOAP11FaultSupport {
     
     public final void AxiomSOAP11Fault.setCode(SOAPFaultCode soapFaultCode)
             throws SOAPProcessingException {
-        if (!(soapFaultCode instanceof AxiomSOAP11FaultCode)) {
-            throw new SOAPProcessingException(
-                    "Expecting SOAP 1.1 implementation of SOAP Fault Code. " +
-                            "But received some other implementation");
-        }
         insertChild(sequence, 0, soapFaultCode);
     }
 
     public final void AxiomSOAP11Fault.setReason(SOAPFaultReason reason) throws SOAPProcessingException {
-        if (!(reason instanceof AxiomSOAP11FaultReason)) {
-            throw new SOAPProcessingException(
-                    "Expecting SOAP 1.1 implementation of SOAP Fault Reason. " +
-                            "But received some other implementation");
-        }
         insertChild(sequence, 1, reason);
     }
 
@@ -64,20 +50,10 @@ public aspect AxiomSOAP11FaultSupport {
     }
 
     public final void AxiomSOAP11Fault.setRole(SOAPFaultRole role) throws SOAPProcessingException {
-        if (!(role instanceof AxiomSOAP11FaultRole)) {
-            throw new SOAPProcessingException(
-                    "Expecting SOAP 1.1 implementation of SOAP Fault Role. " +
-                            "But received some other implementation");
-        }
         insertChild(sequence, 2, role);
     }
 
     public final void AxiomSOAP11Fault.setDetail(SOAPFaultDetail detail) throws SOAPProcessingException {
-        if (!(detail instanceof AxiomSOAP11FaultDetail)) {
-            throw new SOAPProcessingException(
-                    "Expecting SOAP 1.1 implementation of SOAP Fault Detail. " +
-                            "But received some other implementation");
-        }
         insertChild(sequence, 3, detail);
     }
 

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultSupport.aj?rev=1732737&r1=1732736&r2=1732737&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultSupport.aj Sun Feb 28 14:24:08 2016
@@ -27,11 +27,6 @@ import org.apache.axiom.soap.SOAPFaultRe
 import org.apache.axiom.soap.SOAPFaultRole;
 import org.apache.axiom.soap.SOAPProcessingException;
 import org.apache.axiom.soap.impl.intf.AxiomSOAP12Fault;
-import org.apache.axiom.soap.impl.intf.AxiomSOAP12FaultCode;
-import org.apache.axiom.soap.impl.intf.AxiomSOAP12FaultDetail;
-import org.apache.axiom.soap.impl.intf.AxiomSOAP12FaultNode;
-import org.apache.axiom.soap.impl.intf.AxiomSOAP12FaultReason;
-import org.apache.axiom.soap.impl.intf.AxiomSOAP12FaultRole;
 
 public aspect AxiomSOAP12FaultSupport {
     private static final Class<?>[] sequence = { SOAPFaultCode.class, SOAPFaultReason.class,
@@ -42,44 +37,23 @@ public aspect AxiomSOAP12FaultSupport {
     }
     
     public final void AxiomSOAP12Fault.setCode(SOAPFaultCode soapFaultCode) throws SOAPProcessingException {
-        if (!(soapFaultCode instanceof AxiomSOAP12FaultCode)) {
-            throw new SOAPProcessingException(
-                    "Expecting SOAP 1.2 implementation of SOAP Fault Code. " +
-                            "But received some other implementation");
-        }
         insertChild(sequence, 0, soapFaultCode);
     }
 
 
     public final void AxiomSOAP12Fault.setReason(SOAPFaultReason reason) throws SOAPProcessingException {
-        if (!(reason instanceof AxiomSOAP12FaultReason)) {
-            throw new SOAPProcessingException(
-                    "Expecting SOAP 1.2 implementation of SOAP Fault Reason. But received some other implementation");
-        }
         insertChild(sequence, 1, reason);
     }
 
     public final void AxiomSOAP12Fault.setNode(SOAPFaultNode node) throws SOAPProcessingException {
-        if (!(node instanceof AxiomSOAP12FaultNode)) {
-            throw new SOAPProcessingException(
-                    "Expecting SOAP 1.2 implementation of SOAP Fault Node. But received some other implementation");
-        }
         insertChild(sequence, 2, node);
     }
 
     public final void AxiomSOAP12Fault.setRole(SOAPFaultRole role) throws SOAPProcessingException {
-        if (!(role instanceof AxiomSOAP12FaultRole)) {
-            throw new SOAPProcessingException(
-                    "Expecting SOAP 1.2 implementation of SOAP Fault Role. But received some other implementation");
-        }
         insertChild(sequence, 3, role);
     }
 
     public final void AxiomSOAP12Fault.setDetail(SOAPFaultDetail detail) throws SOAPProcessingException {
-        if (!(detail instanceof AxiomSOAP12FaultDetail)) {
-            throw new SOAPProcessingException(
-                    "Expecting SOAP 1.2 implementation of SOAP Fault Detail. But received some other implementation");
-        }
         insertChild(sequence, 4, detail);
     }
 

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAPElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAPElementSupport.aj?rev=1732737&r1=1732736&r2=1732737&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAPElementSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAPElementSupport.aj Sun Feb 28 14:24:08 2016
@@ -19,10 +19,23 @@
 package org.apache.axiom.soap.impl.mixin;
 
 import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.soap.SOAPProcessingException;
 import org.apache.axiom.soap.impl.intf.AxiomSOAPElement;
+import org.apache.axiom.soap.impl.intf.SOAPHelper;
 
 public aspect AxiomSOAPElementSupport {
     public final OMFactory AxiomSOAPElement.getOMFactory() {
         return getSOAPHelper().getSOAPFactory(getMetaFactory());
     }
+
+    public final void AxiomSOAPElement.checkChild(OMNode child) {
+        if (child instanceof AxiomSOAPElement) {
+            SOAPHelper soapHelper = getSOAPHelper();
+            SOAPHelper childSOAPHelper = ((AxiomSOAPElement)child).getSOAPHelper();
+            if (childSOAPHelper != soapHelper) {
+                throw new SOAPProcessingException("Cannot add a " + childSOAPHelper.getSpecName() + " element as a child of a " + soapHelper.getSpecName() + " element");
+            }
+        }
+    }
 }