Source:
<code>private String addDocument( Pair<AttachmentInfo, Metacard> attachmentInfoAndMetacard, List<String> contentTypeList, String transformerParam, <START> InputStream message) <END> throws CatalogException { try { LOGGER.debug("POST"); MimeType mimeType = getMimeType(contentTypeList); CreateResponse createResponse; if (attachmentInfoAndMetacard == null) { CreateRequest createRequest = new CreateRequestImpl(generateMetacard(mimeType, null, message, transformerParam)); createResponse = catalogFramework.create(createRequest); } else { String id = attachmentInfoAndMetacard.getRight() == null ? null : attachmentInfoAndMetacard.getRight().getId(); if (id == null) { id = uuidGenerator.generateUuid(); } CreateStorageRequest streamCreateRequest = new CreateStorageRequestImpl( Collections.singletonList( new IncomingContentItem( id, attachmentInfoAndMetacard.getLeft().getStream(), attachmentInfoAndMetacard.getLeft().getContentType(), attachmentInfoAndMetacard.getLeft().getFilename(), 0L, attachmentInfoAndMetacard.getRight())), null); createResponse = catalogFramework.create(streamCreateRequest); } String id = createResponse.getCreatedMetacards().get(0).getId(); LOGGER.debug("Create Response id [{}]", id); LOGGER.debug("Entry successfully saved, id: {}", id); if (INGEST_LOGGER.isInfoEnabled()) { INGEST_LOGGER.info("Entry successfully saved, id: {}", id); } return id; } catch (SourceUnavailableException e) { String exceptionMessage = "Cannot create catalog entry because source is unavailable: "; LOGGER.info(exceptionMessage, e); throw new InternalServerErrorException(exceptionMessage); } catch (InternalIngestException e) { String exceptionMessage = "Error while storing entry in catalog: "; LOGGER.info(exceptionMessage, e); throw new InternalServerErrorException(exceptionMessage); } catch (MetacardCreationException | IngestException e) { String errorMessage = "Error while storing entry in catalog: "; LOGGER.info(errorMessage, e); throw new CatalogException(errorMessage); } finally { IOUtils.closeQuietly(message); } }</code><technical_language>line(s) of code do need catch IOException for? handling IOException internally</technical_language>

Target:
private String addDocument( Pair<AttachmentInfo, Metacard> attachmentInfoAndMetacard, List<String> contentTypeList, String transformerParam, InputStream message) throws CatalogServiceException { try { LOGGER.debug("POST"); MimeType mimeType = getMimeType(contentTypeList); CreateResponse createResponse; if (attachmentInfoAndMetacard == null) { CreateRequest createRequest = new CreateRequestImpl(generateMetacard(mimeType, null, message, transformerParam)); createResponse = catalogFramework.create(createRequest); } else { String id = attachmentInfoAndMetacard.getRight() == null ? null : attachmentInfoAndMetacard.getRight().getId(); if (id == null) { id = uuidGenerator.generateUuid(); } CreateStorageRequest streamCreateRequest = new CreateStorageRequestImpl( Collections.singletonList( new IncomingContentItem( id, attachmentInfoAndMetacard.getLeft().getStream(), attachmentInfoAndMetacard.getLeft().getContentType(), attachmentInfoAndMetacard.getLeft().getFilename(), 0L, attachmentInfoAndMetacard.getRight())), null); createResponse = catalogFramework.create(streamCreateRequest); } String id = createResponse.getCreatedMetacards().get(0).getId(); LOGGER.debug("Create Response id [{}]", id); LOGGER.debug("Entry successfully saved, id: {}", id); if (INGEST_LOGGER.isInfoEnabled()) { INGEST_LOGGER.info("Entry successfully saved, id: {}", id); } return id; } catch (SourceUnavailableException e) { String exceptionMessage = "Cannot create catalog entry because source is unavailable: "; LOGGER.info(exceptionMessage, e); throw new InternalServerErrorException(exceptionMessage); } catch (InternalIngestException e) { String exceptionMessage = "Error while storing entry in catalog: "; LOGGER.info(exceptionMessage, e); throw new InternalServerErrorException(exceptionMessage); } catch (MetacardCreationException | IngestException e) { String errorMessage = "Error while storing entry in catalog: "; LOGGER.info(errorMessage, e); throw new CatalogServiceException(errorMessage); } finally { IOUtils.closeQuietly(message); } }