Source:
<code>public QueryResponse getSources(@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<VariantSourceEntryWithSampleNames> variantSources = new ArrayList<>(); if (!variantEntity.isPresent()) { response.setStatus(HttpServletResponse.SC_NOT_FOUND); return setQueryResponse(buildQueryResult(variantSources, 0)); } variantEntity.get().getSourceEntries().forEach(sourceEntry -> { variantSources.add(sourceEntry); }); QueryResult<VariantSourceEntryWithSampleNames> queryResult = buildQueryResult(variantSources, variantSources.size()); return setQueryResponse(queryResult); }</code><technical_language>Group exception types handled identically in a single catch block</technical_language>

Target:
public QueryResponse getSources(@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<VariantSourceEntryWithSampleNames> variantSources = new ArrayList<>(); if (!variantEntity.isPresent()) { response.setStatus(HttpServletResponse.SC_NOT_FOUND); return setQueryResponse(buildQueryResult(variantSources, 0)); } variantEntity.get().getSourceEntries().forEach(sourceEntry -> { variantSources.add(sourceEntry); }); QueryResult<VariantSourceEntryWithSampleNames> queryResult = buildQueryResult(variantSources, variantSources.size()); return setQueryResponse(queryResult); }