Source:
<code>public CollectionDescriptions get(HttpServletRequest request, HttpServletResponse response) throws ZebedeeException { info().log("get collections endpoint: request received"); Session session = null; try { session = Root.zebedee.getSessionsService().get(request); if (session == null) { warn().log("get collections endpoint: valid user session not found"); throw new UnauthorizedException("You are not authorized to perform get collections requests"); } CollectionDescriptions result = new CollectionDescriptions(); List<Collection> collections = Root.zebedee.getCollections().list(); for (Collection collection : collections) { if (Root.zebedee.getPermissionsService().canView(session, collection.getDescription())) { CollectionDescription newDesc = new CollectionDescription(); newDesc.setId(collection.getDescription().getId()); newDesc.setName(collection.getDescription().getName()); newDesc.setPublishDate(collection.getDescription().getPublishDate()); newDesc.setApprovalStatus(collection.getDescription().getApprovalStatus()); newDesc.setType(collection.getDescription().getType()); newDesc.setTeams(collection.getDescription().getTeams()); result.add(newDesc); } } java.util.Collections.sort(result, Comparator.comparing(o -> o.getName())); List<String> collectionIds = result.stream().map(c -> c.getId()).collect(Collectors.toList()); info().data("collections", collectionIds).log("user granted canView permission for collections"); return result; } catch (IOException e) { <START> error().data("user", session.getEmail()).logException(e,"get collections endpoint: unexpected error while attempting to get collections"); <END> } return null; }</code><technical_language>need throw a UnexpectedErrorException well</technical_language>

Target:
public CollectionDescriptions get(HttpServletRequest request, HttpServletResponse response) throws ZebedeeException { info().log("get collections endpoint: request received"); Session session = null; try { session = Root.zebedee.getSessionsService().get(request); if (session == null) { warn().log("get collections endpoint: valid user session not found"); throw new UnauthorizedException("You are not authorized to perform get collections requests"); } CollectionDescriptions result = new CollectionDescriptions(); List<Collection> collections = Root.zebedee.getCollections().list(); for (Collection collection : collections) { if (Root.zebedee.getPermissionsService().canView(session, collection.getDescription())) { CollectionDescription newDesc = new CollectionDescription(); newDesc.setId(collection.getDescription().getId()); newDesc.setName(collection.getDescription().getName()); newDesc.setPublishDate(collection.getDescription().getPublishDate()); newDesc.setApprovalStatus(collection.getDescription().getApprovalStatus()); newDesc.setType(collection.getDescription().getType()); newDesc.setTeams(collection.getDescription().getTeams()); result.add(newDesc); } } java.util.Collections.sort(result, Comparator.comparing(o -> o.getName())); List<String> collectionIds = result.stream().map(c -> c.getId()).collect(Collectors.toList()); info().data("collections", collectionIds).log("user granted canView permission for collections"); return result; } catch (IOException e) { error().data("user", session.getEmail()).logException(e,GET_COLLECTIONS_ERROR); throw new UnexpectedErrorException(GET_COLLECTIONS_ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }