You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2016/04/29 17:14:36 UTC

cxf git commit: [CXF-6833] Making sure a reported exception is not ignored

Repository: cxf
Updated Branches:
  refs/heads/master e40c28fcc -> 7fcd84b1f


[CXF-6833] Making sure a reported exception is not ignored


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/7fcd84b1
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/7fcd84b1
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/7fcd84b1

Branch: refs/heads/master
Commit: 7fcd84b1f82a203917a5269a2c0c10a0d5b6f877
Parents: e40c28f
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Fri Apr 29 16:14:20 2016 +0100
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Fri Apr 29 16:14:20 2016 +0100

----------------------------------------------------------------------
 .../cxf/systest/jaxrs/reactive/ObservableWriter.java      | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/7fcd84b1/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/reactive/ObservableWriter.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/reactive/ObservableWriter.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/reactive/ObservableWriter.java
index 88b7e49..198f9b7 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/reactive/ObservableWriter.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/reactive/ObservableWriter.java
@@ -54,7 +54,8 @@ public class ObservableWriter<T> implements MessageBodyWriter<Observable<T>> {
     public void writeTo(Observable<T> obs, Class<?> cls, Type t, Annotation[] anns, MediaType mt,
                         MultivaluedMap<String, Object> headers, OutputStream os)
                             throws IOException, WebApplicationException {
-        obs.subscribe(value -> writeToOutputStream(value, anns, mt, headers, os));   
+        obs.subscribe(value -> writeToOutputStream(value, anns, mt, headers, os),
+            throwable -> throwError(throwable));   
     }
 
     private void writeToOutputStream(T value,
@@ -66,14 +67,17 @@ public class ObservableWriter<T> implements MessageBodyWriter<Observable<T>> {
         MessageBodyWriter<T> writer = 
             (MessageBodyWriter<T>)providers.getMessageBodyWriter(value.getClass(), value.getClass(), anns, mt);
         if (writer == null) {
-            throw ExceptionUtils.toInternalServerErrorException(null, null);
+            throwError(null);
         }
     
         try {
             writer.writeTo(value, value.getClass(), value.getClass(), anns, mt, headers, os);    
         } catch (IOException ex) {
-            throw ExceptionUtils.toInternalServerErrorException(ex, null);
+            throwError(ex);
         }
     }
     
+    private static void throwError(Throwable cause) {
+        throw ExceptionUtils.toInternalServerErrorException(cause, null);
+    }
 }