axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinth...@apache.org
Subject svn commit: r382295 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: AxisFault.java engine/AxisEngine.java fault/FaultCode.java
Date Thu, 02 Mar 2006 04:35:53 GMT
Author: chinthaka
Date: Wed Mar  1 20:35:52 2006
New Revision: 382295

URL: http://svn.apache.org/viewcvs?rev=382295&view=rev
Log:
Fixing to get the fault information from AxisFault.
Some one has changed the internals of AxisFault and has not done a good job to integrate that
with fault handling. This has broken the linkage between Axis2 fault handling and AxisFault.
Better to be more responsible than this :(.

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/AxisFault.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultCode.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/AxisFault.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/AxisFault.java?rev=382295&r1=382294&r2=382295&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/AxisFault.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/AxisFault.java Wed Mar
 1 20:35:52 2006
@@ -205,6 +205,10 @@
         reasons.add(text, language);
     }
 
+    public String getReason() {
+        return reasons.getFirstReasonText();
+    }
+
     /**
      * Iterate over all of the headers
      *
@@ -272,8 +276,8 @@
         return detail;
     }
 
-    public String getFaultCode() {
-        return faultCode.getValueString();
+    public QName getFaultCode() {
+        return faultCode.getValue();
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java?rev=382295&r1=382294&r2=382295&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
Wed Mar  1 20:35:52 2006
@@ -265,12 +265,19 @@
         Object faultCode = context.getProperty(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME);
         String soapFaultCode = "";
 
+        Throwable exception = null;
         if (faultCode != null) {
             fault.setCode((SOAPFaultCode) faultCode);
         } else if (soapException != null) {
             soapFaultCode = soapException.getFaultCode();
-        } else if (e instanceof AxisFault) {
-            soapFaultCode = ((AxisFault) e).getFaultCode();
+        } else if ((exception = e) instanceof AxisFault || (exception = e.getCause()) instanceof
AxisFault) {
+            QName faultCodeQName = ((AxisFault) exception).getFaultCode();
+            String prefix = faultCodeQName.getPrefix();
+            String uri = faultCodeQName.getNamespaceURI();
+            prefix = prefix == null || "".equals(prefix) ? Constants.AXIS2_NAMESPACE_PREFIX
: prefix;
+            uri = uri == null || "".equals(uri) ? Constants.AXIS2_NAMESPACE_URI : uri;
+            soapFaultCode = prefix + ":" + faultCodeQName.getLocalPart();
+            fault.declareNamespace(uri, prefix);
         }
 
         // defaulting to fault code Sender, if no message is available
@@ -288,7 +295,9 @@
         } else if (soapException != null) {
             message = soapException.getMessage();
         } else if (e instanceof AxisFault) {
-            message = e.getMessage();
+            message = ((AxisFault) e).getReason();
+            message = message != null && "".equals(message) ? message : e.getMessage();
+
         }
 
         // defaulting to reason, unknown, if no reason is available
@@ -499,9 +508,9 @@
         // TODO: Make this clearer - should we have transport senders and messagereceivers
as Handlers?
         if (!msgContext.isPaused()) {
 
-//            msgContext.setExecutionChain((ArrayList) msgContext.getConfigurationContext().getAxisConfiguration().getOutFaultFlow().clone());
-//            msgContext.setFLOW(MessageContext.OUT_FLOW);
-//            invoke(msgContext);
+            msgContext.setExecutionChain((ArrayList) msgContext.getConfigurationContext().getAxisConfiguration().getOutFaultFlow().clone());
+            msgContext.setFLOW(MessageContext.OUT_FLOW);
+            invoke(msgContext);
 
             // Actually send the SOAP Fault
             TransportSender sender = msgContext.getTransportOut().getSender();

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultCode.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultCode.java?rev=382295&r1=382294&r2=382295&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultCode.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultCode.java Wed
Mar  1 20:35:52 2006
@@ -24,7 +24,7 @@
 import javax.xml.namespace.QName;
 
 public class FaultCode extends AbstractFaultCode {
-    String value;
+    QName value;
 
     /**
      * simple constructor
@@ -62,11 +62,15 @@
     }
 
     public String getValueString() {
-        return value;
+        return value.getLocalPart();
     }
 
     public void setValue(QName value) {
-        setValueString(value.toString());
+        this.value = value;
+    }
+
+    public QName getValue() {
+        return value;
     }
 
     /**
@@ -75,8 +79,6 @@
      * @param value
      */
     public void setValueString(String value) {
-        QName newName = new QName(value);
-
-        this.value = newName.toString();
+       this.value = new QName(value);
     }
 }



Mime
View raw message