cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1404262 - /cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/atom/AtomPojoProvider.java
Date Wed, 31 Oct 2012 17:30:57 GMT
Author: sergeyb
Date: Wed Oct 31 17:30:57 2012
New Revision: 1404262

URL: http://svn.apache.org/viewvc?rev=1404262&view=rev
Log:
Reporting 400 from AtomPojoProvider in case of read failures

Modified:
    cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/atom/AtomPojoProvider.java

Modified: cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/atom/AtomPojoProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/atom/AtomPojoProvider.java?rev=1404262&r1=1404261&r2=1404262&view=diff
==============================================================================
--- cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/atom/AtomPojoProvider.java
(original)
+++ cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/atom/AtomPojoProvider.java
Wed Oct 31 17:30:57 2012
@@ -544,16 +544,18 @@ public class AtomPojoProvider extends Ab
         }
         
     }
-    
-    private void reportError(String message, Exception ex) {
+    private void reportError(String message, Exception ex, int status) {
         LOG.warning(message);
-        Response response = Response.status(500).type("text/plain").entity(message).build();
+        Response response = Response.status(status).type("text/plain").entity(message).build();
         if (ex == null) {
             throw new WebApplicationException(response);
         } else {
             throw new WebApplicationException(ex, response);
         }
     }
+    private void reportError(String message, Exception ex) {
+        reportError(message, ex, 500);
+    }
     
     private boolean isFeedRequested(MediaType mt) {
         if ("entry".equals(mt.getParameters().get("type"))) {
@@ -631,7 +633,7 @@ public class AtomPojoProvider extends Ab
             m.invoke(instance, new Object[]{objects});
             
         } catch (Exception ex) {
-            reportError("Object of type " + cls.getName() + " can not be deserialized from
Feed", ex);
+            reportError("Object of type " + cls.getName() + " can not be deserialized from
Feed", ex, 400);
         }
         return instance;
     }
@@ -650,7 +652,7 @@ public class AtomPojoProvider extends Ab
                 jaxbProvider.getJAXBContext(cls, cls).createUnmarshaller();
             return cls.cast(um.unmarshal(new StringReader(entry.getContent())));
         } catch (Exception ex) {
-            reportError("Object of type " + cls.getName() + " can not be deserialized from
Entry", ex);
+            reportError("Object of type " + cls.getName() + " can not be deserialized from
Entry", ex, 400);
         }
         return null;
     }



Mime
View raw message