Changeset 5550 for ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java
- Timestamp:
- 08/12/14 14:59:10 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java
r5549 r5550 28 28 import clarin.cmdi.componentregistry.rss.RssCreatorDescriptions; 29 29 import com.google.common.collect.Lists; 30 import com.sun.jersey.api.client.ClientResponse; 31 import com.sun.jersey.api.client.UniformInterfaceException; 30 32 31 33 import com.sun.jersey.api.core.InjectParam; … … 311 313 } 312 314 }; 315 return createDownloadResponse(result, fileName); 313 316 } else if ("xsd".equalsIgnoreCase(rawType)) { 314 317 result = new StreamingOutput() { … … 344 347 } 345 348 }; 349 return createDownloadResponse(result, fileName); 346 350 } else { 347 throw new WebApplicationException(Response 348 .serverError() 349 .entity("unsupported rawType: " + rawType 350 + " (only xml or xsd are supported)").build()); 351 return Response.status(Status.NOT_FOUND).entity("Usupported raw type "+rawType).build(); 351 352 } 352 return createDownloadResponse(result, fileName);353 353 354 354 355 } catch (UserUnauthorizedException e2) { … … 876 877 .build(); 877 878 } catch (ItemNotFoundException e) { 878 LOG.warn("Profile with id " + profileId + " is not found.", 879 e); 879 LOG.warn("Profile with id " + profileId + " is not found."); 880 880 return Response.serverError().status(Status.NOT_FOUND) 881 881 .build(); … … 931 931 return Response.serverError().status(Status.FORBIDDEN) 932 932 .entity("" + e.getMessage()).build(); 933 } catch (ComponentRegistryException e) { 934 LOG.info("Could not retrieve component", e); 933 } 934 catch (ComponentRegistryException e) { 935 LOG.info("Could not find comment "+commentId+ " for "+profileId); 935 936 return Response.serverError().status(Status.INTERNAL_SERVER_ERROR) 936 937 .build(); 937 } catch (IOException e) { 938 } 939 catch (IOException e) { 938 940 LOG.error("Comment with id: " + commentId + " deletion failed.", e); 939 941 return Response.serverError().status(Status.INTERNAL_SERVER_ERROR) … … 983 985 return Response.serverError().status(Status.FORBIDDEN) 984 986 .entity("" + e.getMessage()).build(); 985 } catch (ComponentRegistryException e) { 986 LOG.info("Could not retrieve component ", e);987 } catch (ComponentRegistryException e) { 988 LOG.info("Could not retrieve component "+componentId+" for the component "+componentId); 987 989 return Response.serverError().status(Status.INTERNAL_SERVER_ERROR) 988 990 .build(); … … 1012 1014 public Response getRegisteredProfileRawType( 1013 1015 @PathParam("profileId") final String profileId, 1014 @PathParam("rawType") String rawType) throws ComponentRegistryException {1016 @PathParam("rawType") String rawType) throws ComponentRegistryException, IllegalArgumentException { 1015 1017 1016 1018 … … 1064 1066 }; 1065 1067 } else { 1066 throw new WebApplicationException(Response 1067 .serverError() 1068 .entity("unsupported rawType: " + rawType 1069 + " (only xml or xsd are supported)").build()); 1068 return Response.status(Status.NOT_FOUND).entity("Unsupported raw type "+rawType).build(); 1070 1069 } 1071 1070 return createDownloadResponse(result, fileName);
Note: See TracChangeset
for help on using the changeset viewer.