Source:
<code>public List<ComparePair> compareS3ToMs(Path p) throws IOException { Stopwatch stopwatch = Stopwatch.createStarted(); int scannedItems = 0; final Path rootPath = rawFS.qualify(p); S3AFileStatus root = null; try { root = (S3AFileStatus) rawFS.getFileStatus(rootPath); } catch (AWSBadRequestException e) { <START> throw new IOException(e.getMessage()); <END> } final List<ComparePair> comparePairs = new ArrayList<>(); final Queue<S3AFileStatus> queue = new ArrayDeque<>(); queue.add(root); while (!queue.isEmpty()) { final S3AFileStatus currentDir = queue.poll(); scannedItems++; final Path currentDirPath = currentDir.getPath(); List<FileStatus> s3DirListing = Arrays.asList(rawFS.listStatus(currentDirPath)); compareAuthoritativeDirectoryFlag(comparePairs, currentDirPath, s3DirListing); s3DirListing.stream().filter(pm -> pm.isDirectory()) .map(S3AFileStatus.class::cast) .forEach(pm -> queue.add(pm)); final List<S3AFileStatus> children = s3DirListing.stream() .filter(status -> !status.isDirectory()) .map(S3AFileStatus.class::cast).collect(toList()); final List<ComparePair> compareResult = compareS3DirToMs(currentDir, children).stream() .filter(comparePair -> comparePair.containsViolation()) .collect(toList()); comparePairs.addAll(compareResult); scannedItems += children.size(); } stopwatch.stop(); S3GuardFsckViolationHandler handler = new S3GuardFsckViolationHandler(rawFS, metadataStore); comparePairs.forEach(handler::handle); LOG.info("Total scan time: {}s", stopwatch.elapsed(TimeUnit.SECONDS)); LOG.info("Scanned entries: {}", scannedItems); return comparePairs; }</code><technical_language>This is IOE; need convert (while losing stack)</technical_language>

Target:
public List<ComparePair> compareS3ToMs(Path p) throws IOException { Stopwatch stopwatch = Stopwatch.createStarted(); int scannedItems = 0; final Path rootPath = rawFS.qualify(p); S3AFileStatus root = (S3AFileStatus) rawFS.getFileStatus(rootPath); final List<ComparePair> comparePairs = new ArrayList<>(); final Queue<S3AFileStatus> queue = new ArrayDeque<>(); queue.add(root); while (!queue.isEmpty()) { final S3AFileStatus currentDir = queue.poll(); final Path currentDirPath = currentDir.getPath(); try { List<FileStatus> s3DirListing = Arrays.asList( rawFS.listStatus(currentDirPath)); compareAuthoritativeDirectoryFlag(comparePairs, currentDirPath, s3DirListing); s3DirListing.stream().filter(pm -> pm.isDirectory()) .map(S3AFileStatus.class::cast) .forEach(pm -> queue.add(pm)); final List<S3AFileStatus> children = s3DirListing.stream() .filter(status -> !status.isDirectory()) .map(S3AFileStatus.class::cast).collect(toList()); final List<ComparePair> compareResult = compareS3DirContentToMs(currentDir, children); comparePairs.addAll(compareResult); scannedItems++; scannedItems += children.size(); } catch (FileNotFoundException e) { LOG.error("The path has been deleted since it was queued: " + currentDirPath, e); } } stopwatch.stop(); S3GuardFsckViolationHandler handler = new S3GuardFsckViolationHandler(rawFS, metadataStore); comparePairs.forEach(handler::handle); LOG.info("Total scan time: {}s", stopwatch.elapsed(TimeUnit.SECONDS)); LOG.info("Scanned entries: {}", scannedItems); return comparePairs; }