Source:
<code>private String downloadSegmentToLocal(String uri, PinotCrypter crypter, String tableName, String segmentName) throws Exception { File tempDir = new File(new File(_instanceDataManager.getSegmentFileDirectory(), tableName), "tmp-" + segmentName + "-" + UUID.randomUUID()); FileUtils.forceMkdir(tempDir); File tempDownloadFile = new File(tempDir, segmentName + ENCODED_SUFFIX); File tempTarFile = new File(tempDir, segmentName + TAR_GZ_SUFFIX); File tempSegmentDir = new File(tempDir, segmentName); try { SegmentFetcherFactory.fetchSegmentToLocal(uri, tempDownloadFile); if (crypter != null) { crypter.decrypt(tempDownloadFile, tempTarFile); } else { tempTarFile = tempDownloadFile; } LOGGER .info("Downloaded tarred segment: for table: from: to: {}, file length: {}", segmentName, tableName, uri, tempTarFile, tempTarFile.length()); try { File tempIndexDir = TarGzCompressionUtils.untar(tempTarFile, tempSegmentDir).get(0); File indexDir = new File(new File(_instanceDataManager.getSegmentDataDirectory(), tableName), segmentName); if (indexDir.exists()) { LOGGER.info("Deleting existing index directory for segment: for table: {}", segmentName, tableName); FileUtils.deleteDirectory(indexDir); } FileUtils.moveDirectory(tempIndexDir, indexDir); LOGGER.info("Successfully downloaded segment: for table: to: {}", segmentName, tableName, indexDir); return indexDir.getAbsolutePath(); } catch (Exception e) { _serverMetrics.addMeteredTableValue(tableName, ServerMeter.UNTAR_FAILURES, 1L); <START> throw e; <END> } } finally { FileUtils.deleteQuietly(tempDir); } }</code><technical_language>Utils.rethrow() original exception type</technical_language>

Target:
private String downloadSegmentToLocal(String uri, PinotCrypter crypter, String tableName, String segmentName) throws Exception { File tempDir = new File(new File(_instanceDataManager.getSegmentFileDirectory(), tableName), "tmp-" + segmentName + "-" + UUID.randomUUID()); FileUtils.forceMkdir(tempDir); File tempDownloadFile = new File(tempDir, segmentName + ENCODED_SUFFIX); File tempTarFile = new File(tempDir, segmentName + TAR_GZ_SUFFIX); File tempSegmentDir = new File(tempDir, segmentName); try { SegmentFetcherFactory.fetchSegmentToLocal(uri, tempDownloadFile); if (crypter != null) { crypter.decrypt(tempDownloadFile, tempTarFile); } else { tempTarFile = tempDownloadFile; } LOGGER .info("Downloaded tarred segment: for table: from: to: {}, file length: {}", segmentName, tableName, uri, tempTarFile, tempTarFile.length()); try { File tempIndexDir = TarGzCompressionUtils.untar(tempTarFile, tempSegmentDir).get(0); File indexDir = new File(new File(_instanceDataManager.getSegmentDataDirectory(), tableName), segmentName); if (indexDir.exists()) { LOGGER.info("Deleting existing index directory for segment: for table: {}", segmentName, tableName); FileUtils.deleteDirectory(indexDir); } FileUtils.moveDirectory(tempIndexDir, indexDir); LOGGER.info("Successfully downloaded segment: for table: to: {}", segmentName, tableName, indexDir); return indexDir.getAbsolutePath(); } catch (Exception e) { _serverMetrics.addMeteredTableValue(tableName, ServerMeter.UNTAR_FAILURES, 1L); Utils.rethrowException(e); return null; } } finally { FileUtils.deleteQuietly(tempDir); } }