Changeset 5551


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

Fixed issued arising after testing on localhost tomcat (not fully)

Location:
ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/ComponentRegistryFactoryDbImpl.java

    r5549 r5551  
    8282        }
    8383        ComponentRegistryDbImpl cr = componentRegistryBeanFactory.getNewComponentRegistry();// default public registry
    84         cr.setRegistrySpace(RegistrySpace.PRIVATE);
     84        cr.setRegistrySpace(RegistrySpace.GROUP);
    8585        cr.setRegistryOwner(owner);
    8686        cr.setGroupId(groupId);
  • ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java

    r5550 r5551  
    163163    }
    164164
     165    private boolean checkRegistrySpaceString(String registrySpace) {
     166        return (registrySpace.equalsIgnoreCase("group") || registrySpace.equalsIgnoreCase("private") || registrySpace.equalsIgnoreCase("published"));
     167    }
     168
    165169    @Override
    166170    @GET
     
    173177            throws ComponentRegistryException, IOException {
    174178        long start = System.currentTimeMillis();
     179
     180        if (!checkRegistrySpaceString(registrySpace)) {
     181            response.sendError(Status.NOT_FOUND.getStatusCode(), "illegal registry space");
     182            return new ArrayList<ComponentDescription>();
     183        }
    175184
    176185        try {
     
    205214
    206215        long start = System.currentTimeMillis();
     216       
     217        if (!checkRegistrySpaceString(registrySpace)) {
     218            response.sendError(Status.NOT_FOUND.getStatusCode(), "illegal registry space");
     219            return new ArrayList<ProfileDescription>();
     220        }
    207221        try {
    208222            ComponentRegistry cr = this.initialiseRegistry(registrySpace, groupId);
     
    349363                    return createDownloadResponse(result, fileName);
    350364                } else {
    351                     return Response.status(Status.NOT_FOUND).entity("Usupported raw type "+rawType).build();
     365                    return Response.status(Status.NOT_FOUND).entity("Usupported raw type " + rawType).build();
    352366                }
    353                
     367
    354368
    355369            } catch (UserUnauthorizedException e2) {
     
    758772        try {
    759773            ComponentRegistry br = this.getBaseRegistry();
    760             ComponentDescription desc =br.getComponentDescriptionAccessControlled(componentId);
     774            ComponentDescription desc = br.getComponentDescriptionAccessControlled(componentId);
    761775            if (desc != null) {
    762776                if (desc.isPublic()) {
     
    931945            return Response.serverError().status(Status.FORBIDDEN)
    932946                    .entity("" + e.getMessage()).build();
    933         }
    934         catch (ComponentRegistryException e) {
    935             LOG.info("Could not find comment "+commentId+ " for "+profileId);
     947        } catch (ComponentRegistryException e) {
     948            LOG.info("Could not find comment " + commentId + " for " + profileId);
    936949            return Response.serverError().status(Status.INTERNAL_SERVER_ERROR)
    937950                    .build();
    938         }
    939         catch (IOException e) {
     951        } catch (IOException e) {
    940952            LOG.error("Comment with id: " + commentId + " deletion failed.", e);
    941953            return Response.serverError().status(Status.INTERNAL_SERVER_ERROR)
     
    985997            return Response.serverError().status(Status.FORBIDDEN)
    986998                    .entity("" + e.getMessage()).build();
    987         } catch (ComponentRegistryException e) {           
    988             LOG.info("Could not retrieve component "+componentId+" for the component "+componentId);
     999        } catch (ComponentRegistryException e) {
     1000            LOG.info("Could not retrieve component " + componentId + " for the component " + componentId);
    9891001            return Response.serverError().status(Status.INTERNAL_SERVER_ERROR)
    9901002                    .build();
     
    10661078                };
    10671079            } else {
    1068                 return Response.status(Status.NOT_FOUND).entity("Unsupported raw type "+rawType).build();
     1080                return Response.status(Status.NOT_FOUND).entity("Unsupported raw type " + rawType).build();
    10691081            }
    10701082            return createDownloadResponse(result, fileName);
Note: See TracChangeset for help on using the changeset viewer.