Author: rwesten
Date: Wed May  6 12:41:48 2015
New Revision: 1677977

URL: http://svn.apache.org/r1677977
Log:
minor: RDF parsing error when uploading RDF data to the Enitityhub now result 
in a BAD_REQUEST response instead of a 500 Internal Server Error

Modified:
    
stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/web/reader/RepresentationReader.java

Modified: 
stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/web/reader/RepresentationReader.java
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/web/reader/RepresentationReader.java?rev=1677977&r1=1677976&r2=1677977&view=diff
==============================================================================
--- 
stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/web/reader/RepresentationReader.java
 (original)
+++ 
stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/web/reader/RepresentationReader.java
 Wed May  6 12:41:48 2015
@@ -264,15 +264,16 @@ public class RepresentationReader implem
                     Response.status(Status.INTERNAL_SERVER_ERROR).
                     entity(message).
                     header(HttpHeaders.ACCEPT, acceptedMediaType).build());
-            } catch (Exception e){
-                String message = "Unable to create the Parser for the 
supported format "
-                    +content.getMediaType()+" ("+e+")";
+            } catch (RuntimeException e){
+                //NOTE: Clerezza seams not to provide specific exceptions on
+                //      parsing errors. Hence the catch for all 
RuntimeException
+                String message = "Unable to parse the provided RDF data 
(format: "
+                    +content.getMediaType()+", message: "+e.getMessage()+")";
                 log.error(message,e);
                 throw new WebApplicationException(
-                    Response.status(Status.INTERNAL_SERVER_ERROR).
+                    Response.status(Status.BAD_REQUEST).
                     entity(message).
                     header(HttpHeaders.ACCEPT, acceptedMediaType).build());
-                
             }
             for(Iterator<Triple> st = graph.iterator();st.hasNext();){
                 NonLiteral resource = st.next().getSubject();


Reply via email to