Source:
<code>public void executeOperation(VersionCollectionRequest request, RepositoryPath artifactPath, List<RepositoryPath> versionDirectories) throws IOException { String repositoryId = getRepository().getId(); String storageId = getStorage().getId(); String contextId = getContextId(storageId, repositoryId, IndexTypeEnum.LOCAL.getType()); RepositoryIndexer indexer = repositoryIndexManager.getRepositoryIndexer(contextId); if (indexer == null) { return; } for (RepositoryPath versionDirectoryAbs : versionDirectories) { RepositoryPath artifactVersionDirectoryRelative = versionDirectoryAbs.getRepositoryRelative(); int pathElementCount = artifactVersionDirectoryRelative.getNameCount(); StringBuilder groupId = new StringBuilder(); for (int i = 0; i < pathElementCount - 2; i++) { String element = artifactVersionDirectoryRelative.getName(i).toString(); groupId.append((groupId.length() == 0) ? element : "." + element); } String artifactId = artifactVersionDirectoryRelative.getName(pathElementCount - 2).toString(); String version = artifactVersionDirectoryRelative.getName(pathElementCount - 1).toString(); DetachedArtifact artifact = (DetachedArtifact) ArtifactUtils.getArtifactFromGAVTC(groupId + ":" + artifactId + ":" + version); Files.walk(versionDirectoryAbs) .filter(Files::isRegularFile) .forEach(f -> { String fileName = f.getFileName().toString(); String extension = fileName.substring(fileName.lastIndexOf('.') + 1, fileName.length()); artifact.setFile(f.toFile()); try { indexer.addArtifactToIndex(repositoryId, f.toFile(), artifact); } <START> catch (IOException e) <END> { logger.error(String.format("Failed to add artifact to index for [%s]", f)); } }); } }</code><technical_language>-1: (Ignore)</technical_language>

Target:
public void executeOperation(VersionCollectionRequest request, RepositoryPath artifactPath, List<RepositoryPath> versionDirectories) throws IOException { String repositoryId = artifactPath.getFileSystem().getRepository().getId(); String storageId = artifactPath.getFileSystem().getRepository().getStorage().getId(); String contextId = getContextId(storageId, repositoryId, IndexTypeEnum.LOCAL.getType()); RepositoryIndexer indexer = repositoryIndexManager.getRepositoryIndexer(contextId); if (indexer == null) { return; } for (RepositoryPath versionDirectoryAbs : versionDirectories) { RepositoryPath artifactVersionDirectoryRelative = versionDirectoryAbs.getRepositoryRelative(); int pathElementCount = artifactVersionDirectoryRelative.getNameCount(); StringBuilder groupId = new StringBuilder(); for (int i = 0; i < pathElementCount - 2; i++) { String element = artifactVersionDirectoryRelative.getName(i).toString(); groupId.append((groupId.length() == 0) ? element : "." + element); } String artifactId = artifactVersionDirectoryRelative.getName(pathElementCount - 2).toString(); String version = artifactVersionDirectoryRelative.getName(pathElementCount - 1).toString(); DetachedArtifact artifact = (DetachedArtifact) ArtifactUtils.getArtifactFromGAVTC(groupId + ":" + artifactId + ":" + version); Files.walk(versionDirectoryAbs) .filter(Files::isRegularFile) .forEach(f -> { artifact.setFile(f.toFile()); try { indexer.addArtifactToIndex(repositoryId, f.toFile(), artifact); } catch (IOException e) { logger.error(String.format("Failed to add artifact to index for [%s]", f), e); } }); } }