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 2010/01/12 22:38:43 UTC

svn commit: r898532 - in /cxf/branches/2.1.x-fixes: ./ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Servant.java systests/uncategorized/pom.xml

Author: dkulp
Date: Tue Jan 12 21:38:43 2010
New Revision: 898532

URL: http://svn.apache.org/viewvc?rev=898532&view=rev
Log:
Merged revisions 898528 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.2.x-fixes

................
  r898528 | dkulp | 2010-01-12 16:37:00 -0500 (Tue, 12 Jan 2010) | 9 lines
  
  Merged revisions 898526 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r898526 | dkulp | 2010-01-12 16:35:18 -0500 (Tue, 12 Jan 2010) | 1 line
    
    [CXF-685] Add proper fault generation to RM Servant
  ........
................

Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Servant.java
    cxf/branches/2.1.x-fixes/systests/uncategorized/pom.xml

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue Jan 12 21:38:43 2010
@@ -0,0 +1,2 @@
+/cxf/branches/2.2.x-fixes:898528
+/cxf/trunk:898526

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.1.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Servant.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Servant.java?rev=898532&r1=898531&r2=898532&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Servant.java (original)
+++ cxf/branches/2.1.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Servant.java Tue Jan 12 21:38:43 2010
@@ -27,7 +27,11 @@
 
 import javax.xml.datatype.Duration;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.binding.Binding;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.jaxb.DatatypeFactory;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
@@ -52,6 +56,25 @@
         reliableEndpoint = rme;
     }
     
+    private void throwSequenceFault(SequenceFault sf, Exchange exchange) {
+        Endpoint e = exchange.get(Endpoint.class);
+        Binding b = null;
+        if (null != e) {
+            b = e.getBinding();
+        }
+        Bus bus = exchange.get(Bus.class);
+        if (null != b && bus != null) {
+            RMManager m = bus.getExtension(RMManager.class);
+            LOG.fine("Manager: " + m);
+            BindingFaultFactory bff = m.getBindingFaultFactory(b);
+            Fault f = bff.createFault(sf);
+            LogUtils.log(LOG, Level.SEVERE, "SEQ_FAULT_MSG", bff.toString(f));
+            throw f;
+        }
+        throw new Fault(sf);
+    }
+    
+    
     public Object invoke(Exchange exchange, Object o) {
         LOG.fine("Invoking on RM Endpoint");
         OperationInfo oi = exchange.get(OperationInfo.class);
@@ -60,16 +83,14 @@
             return null;
         }
         
-        // TODO: throw Fault, see AbstractRMInterceptor
-        
         if (RMConstants.getCreateSequenceOperationName().equals(oi.getName())
             || RMConstants.getCreateSequenceOnewayOperationName().equals(oi.getName())) {
             try {
                 return Collections.singletonList(createSequence(exchange.getInMessage()));
             } catch (SequenceFault ex) {
-                ex.printStackTrace();
+                throwSequenceFault(ex, exchange);
             } catch (Exception ex) {
-                ex.printStackTrace();
+                throw new Fault(ex);
             }
         } else if (RMConstants.getCreateSequenceResponseOnewayOperationName().equals(oi.getName())) {
             CreateSequenceResponseType createResponse = 
@@ -77,15 +98,15 @@
             try {
                 createSequenceResponse(createResponse);
             } catch (SequenceFault ex) {
-                ex.printStackTrace();
+                throwSequenceFault(ex, exchange);
             }
         } else if (RMConstants.getTerminateSequenceOperationName().equals(oi.getName())) {            
             try {
                 terminateSequence(exchange.getInMessage());
             } catch (SequenceFault ex) {
-                ex.printStackTrace();
+                throwSequenceFault(ex, exchange);
             } catch (RMException ex) {
-                ex.printStackTrace();
+                throw new Fault(ex);
             }
         }
         

Modified: cxf/branches/2.1.x-fixes/systests/uncategorized/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/uncategorized/pom.xml?rev=898532&r1=898531&r2=898532&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/uncategorized/pom.xml (original)
+++ cxf/branches/2.1.x-fixes/systests/uncategorized/pom.xml Tue Jan 12 21:38:43 2010
@@ -223,11 +223,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-rt-ws-rm</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-ws-policy</artifactId>
             <version>${project.version}</version>
         </dependency>