Author: shankar
Date: Tue Dec 21 14:03:03 2010
New Revision: 1051498

URL: http://svn.apache.org/viewvc?rev=1051498&view=rev
Log:
Fixing issue RAMPART-290

Modified:
    
axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java

Modified: 
axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java?rev=1051498&r1=1051497&r2=1051498&view=diff
==============================================================================
--- 
axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java
 (original)
+++ 
axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java
 Tue Dec 21 14:03:03 2010
@@ -327,46 +327,41 @@ public class RampartEngine {
 
        
        private boolean isSecurityFault(RampartMessageData rmd) {
-           
-           SOAPEnvelope soapEnvelope = rmd.getMsgContext().getEnvelope();    
-           
-           SOAPFault soapFault = soapEnvelope.getBody().getFault();
-            
-            // This is not a soap fault
-            if (soapFault == null) {
-                return false;
-            }
-            
-            String soapVersionURI =  
rmd.getMsgContext().getEnvelope().getNamespace().getNamespaceURI();
-                   
-           if 
(soapVersionURI.equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI) ) {
-               
-               SOAPFaultCode faultCode = soapFault.getCode();
-               
-               // This is a fault processing the security header 
-                if 
(faultCode.getTextAsQName().getNamespaceURI().equals(WSConstants.WSSE_NS)) {
-                   return true;
-                }
-               
-                               
-           } else if 
(soapVersionURI.equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
-               
-               //TODO AXIOM API returns only one fault sub code, there can be 
many
-               SOAPFaultSubCode faultSubCode = 
soapFault.getCode().getSubCode();
-               
-               if (faultSubCode != null) {
-                       SOAPFaultValue faultSubCodeValue = 
faultSubCode.getValue();
-                       
-                       // This is a fault processing the security header 
-                       if (faultSubCodeValue != null &&
-                               
faultSubCodeValue.getTextAsQName().getNamespaceURI().equals(WSConstants.WSSE_NS))
 {
-                          return true;
-                       }
-               }
-               
-           }
-           
-           return false;
-       }
 
+               SOAPEnvelope soapEnvelope = rmd.getMsgContext().getEnvelope();
+               SOAPFault soapFault = soapEnvelope.getBody().getFault();
+
+               // This is not a soap fault
+               if (soapFault == null) {
+                       return false;
+               }
+
+               String soapVersionURI = 
rmd.getMsgContext().getEnvelope().getNamespace().getNamespaceURI();
+               SOAPFaultCode faultCode = soapFault.getCode();
+               if(faultCode == null){
+                       //If no fault code is given, then it can't be security 
fault
+                       return false;
+               }
+               
+               if 
(soapVersionURI.equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
+                       // This is a fault processing the security header
+                       if 
(faultCode.getTextAsQName().getNamespaceURI().equals(WSConstants.WSSE_NS)) {
+                               return true;
+                       }
+               } else if 
(soapVersionURI.equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
+                       // TODO AXIOM API returns only one fault sub code, 
there can be many
+                       SOAPFaultSubCode faultSubCode = faultCode.getSubCode();
+                       if (faultSubCode != null) {
+                               SOAPFaultValue faultSubCodeValue = 
faultSubCode.getValue();
+
+                               // This is a fault processing the security 
header
+                               if (faultSubCodeValue != null && 
faultSubCodeValue.getTextAsQName().
+                                               
getNamespaceURI().equals(WSConstants.WSSE_NS)) {
+                                       return true;
+                               }
+                       }
+               }
+
+               return false;
+       }
 }


Reply via email to