Source:
<code>public void execute(RepositoryPath path) throws IOException { List<Path> filePaths = Files.list(path) .filter(p -> { try { return Boolean.TRUE.equals(Files.getAttribute(p, RepositoryFileAttributes.METADATA)); } catch (IOException e) { logger.error(String.format("Failed to read attributes for [%s]", p), e); } return false; }).collect(Collectors.toList()); RepositoryPath parentPath = path.getParent() .toAbsolutePath(); if (filePaths.isEmpty()) { return; } if (!getVisitedRootPaths().isEmpty() && getVisitedRootPaths().containsKey(parentPath)) { List<RepositoryPath> visitedVersionPaths = getVisitedRootPaths().get(parentPath); if (visitedVersionPaths.contains(path)) { return; } } if (logger.isDebugEnabled()) { System.out.println(parentPath); } if (previousPath != null && !parentPath.startsWith(previousPath)) { getVisitedRootPaths().remove(previousPath); previousPath = parentPath; } if (previousPath == null) { previousPath = parentPath; } List<RepositoryPath> versionDirectories = getVersionDirectories(parentPath); if (versionDirectories == null || versionDirectories.isEmpty()) { return; } getVisitedRootPaths().put(parentPath, versionDirectories); if (logger.isDebugEnabled()) { for (Path directory : versionDirectories) { System.out.println(" " + directory.toAbsolutePath().toString()); } } RepositoryPath basePath = versionDirectories.get(0).getParent(); <START> RepositoryLayoutFileSystemProvider provider = (RepositoryLayoutFileSystemProvider) basePath.getFileSystem() <END> .provider(); try { provider.storeChecksum(basePath, forceRegeneration); } catch (NoSuchAlgorithmException e) { throw new IOException(e); } }</code><technical_language>![CRITICAL](<LINK_0> 'Severity: CRITICAL') null pointer dereference in org.carlspring.strongbox.artifact.locator.handlers.ArtifactLocationGenerateChecksumOperation.execute(RepositoryPath) due return of called method [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public void execute(RepositoryPath path) throws IOException { List<Path> filePaths = Files.list(path) .filter(p -> { try { return Boolean.TRUE.equals(Files.getAttribute(p, RepositoryFileAttributes.METADATA)); } catch (IOException e) { logger.error(String.format("Failed to read attributes for [%s]", p), e); } return false; }).collect(Collectors.toList()); RepositoryPath parentPath = path.getParent() .toAbsolutePath(); if (filePaths.isEmpty()) { return; } if (!getVisitedRootPaths().isEmpty() && getVisitedRootPaths().containsKey(parentPath)) { List<RepositoryPath> visitedVersionPaths = getVisitedRootPaths().get(parentPath); if (visitedVersionPaths.contains(path)) { return; } } if (logger.isDebugEnabled()) { System.out.println(parentPath); } if (previousPath != null && !parentPath.startsWith(previousPath)) { getVisitedRootPaths().remove(previousPath); previousPath = parentPath; } if (previousPath == null) { previousPath = parentPath; } List<RepositoryPath> versionDirectories = getVersionDirectories(parentPath); if (versionDirectories == null || versionDirectories.isEmpty()) { return; } getVisitedRootPaths().put(parentPath, versionDirectories); if (logger.isDebugEnabled()) { for (Path directory : versionDirectories) { System.out.println(" " + directory.toAbsolutePath().toString()); } } RepositoryPath basePath = versionDirectories.get(0).getParent(); RepositoryLayoutFileSystemProvider provider = (RepositoryLayoutFileSystemProvider) basePath.getFileSystem() .provider(); provider.storeChecksum(basePath, forceRegeneration); }