Source:
<code>public QueryResponse getAnnotations(@PathVariable("variantCoreString") String variantCoreString, @RequestParam(name = "species") String species, @RequestParam(name = "assembly") String assembly, @RequestParam(name = "annot-vep-version", required = false) String annotationVepVersion, @RequestParam(name = "annot-vep-cache-version", required = false) String annotationVepCacheVersion, HttpServletResponse response) throws IllegalArgumentException { initializeQuery(); try { checkParameters(variantCoreString, annotationVepVersion, annotationVepCacheVersion, species, assembly); } catch (IllegalArgumentException e) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return setErrorQueryResponse(e.getMessage()); } MultiMongoDbFactory.setDatabaseNameForCurrentThread(DBAdaptorConnector.getDBName(species + "_" + assembly)); Optional<VariantWithSamplesAndAnnotation> variantEntity; try { variantEntity = getVariantByCoordinatesAndAnnotationVersion(variantCoreString, annotationVepVersion, annotationVepCacheVersion); } catch (AnnotationMetadataNotFoundException ex) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return setQueryResponse(ex.getMessage()); <START> } catch (IllegalArgumentException ex) { <END> response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return setQueryResponse(ex.getMessage()); } List<Annotation> annotations = new ArrayList<>(); if (!variantEntity.isPresent()) { response.setStatus(HttpServletResponse.SC_NOT_FOUND); return setQueryResponse(buildQueryResult(annotations, 0)); } annotations.add(variantEntity.get().getAnnotation()); QueryResult<Annotation> queryResult = buildQueryResult(annotations, annotations.size()); return setQueryResponse(queryResult); }</code><technical_language>Again, multiple exception types handled identically grouped in a single catch block</technical_language>

Target:
public QueryResponse getAnnotations(@PathVariable("variantCoreString") String variantCoreString, @RequestParam(name = "species") String species, @RequestParam(name = "assembly") String assembly, @RequestParam(name = "annot-vep-version", required = false) String annotationVepVersion, @RequestParam(name = "annot-vep-cache-version", required = false) String annotationVepCacheVersion, HttpServletResponse response) throws IllegalArgumentException { initializeQuery(); try { checkParameters(variantCoreString, annotationVepVersion, annotationVepCacheVersion, species, assembly); } catch (IllegalArgumentException e) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return setErrorQueryResponse(e.getMessage()); } MultiMongoDbFactory.setDatabaseNameForCurrentThread(DBAdaptorConnector.getDBName(species + "_" + assembly)); Optional<VariantWithSamplesAndAnnotation> variantEntity; try { variantEntity = getVariantByCoordinatesAndAnnotationVersion(variantCoreString, annotationVepVersion, annotationVepCacheVersion); } catch (AnnotationMetadataNotFoundException | IllegalArgumentException ex) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return setQueryResponse(ex.getMessage()); } List<Annotation> annotations = new ArrayList<>(); if (!variantEntity.isPresent() || variantEntity.get().getAnnotation() == null) { response.setStatus(HttpServletResponse.SC_NOT_FOUND); return setQueryResponse(buildQueryResult(annotations, 0)); } annotations.add(variantEntity.get().getAnnotation()); QueryResult<Annotation> queryResult = buildQueryResult(annotations, annotations.size()); return setQueryResponse(queryResult); }