Ignore:
Timestamp:
08/12/14 14:59:10 (10 years ago)
Author:
olhsha@mpi.nl
Message:

Fixed exception that have appeared while unit-testing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java

    r5549 r5550  
    2828import clarin.cmdi.componentregistry.rss.RssCreatorDescriptions;
    2929import com.google.common.collect.Lists;
     30import com.sun.jersey.api.client.ClientResponse;
     31import com.sun.jersey.api.client.UniformInterfaceException;
    3032
    3133import com.sun.jersey.api.core.InjectParam;
     
    311313                        }
    312314                    };
     315                    return createDownloadResponse(result, fileName);
    313316                } else if ("xsd".equalsIgnoreCase(rawType)) {
    314317                    result = new StreamingOutput() {
     
    344347                        }
    345348                    };
     349                    return createDownloadResponse(result, fileName);
    346350                } 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();
    351352                }
    352                 return createDownloadResponse(result, fileName);
     353               
    353354
    354355            } catch (UserUnauthorizedException e2) {
     
    876877                    .build();
    877878        } 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.");
    880880            return Response.serverError().status(Status.NOT_FOUND)
    881881                    .build();
     
    931931            return Response.serverError().status(Status.FORBIDDEN)
    932932                    .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);
    935936            return Response.serverError().status(Status.INTERNAL_SERVER_ERROR)
    936937                    .build();
    937         } catch (IOException e) {
     938        }
     939        catch (IOException e) {
    938940            LOG.error("Comment with id: " + commentId + " deletion failed.", e);
    939941            return Response.serverError().status(Status.INTERNAL_SERVER_ERROR)
     
    983985            return Response.serverError().status(Status.FORBIDDEN)
    984986                    .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);
    987989            return Response.serverError().status(Status.INTERNAL_SERVER_ERROR)
    988990                    .build();
     
    10121014    public Response getRegisteredProfileRawType(
    10131015            @PathParam("profileId") final String profileId,
    1014             @PathParam("rawType") String rawType) throws ComponentRegistryException {
     1016            @PathParam("rawType") String rawType) throws ComponentRegistryException, IllegalArgumentException {
    10151017
    10161018
     
    10641066                };
    10651067            } 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();
    10701069            }
    10711070            return createDownloadResponse(result, fileName);
Note: See TracChangeset for help on using the changeset viewer.