/** * This implementation compares the underlying Path references. */ @Override public boolean equals(Object other) { return (this == other || (other instanceof PathResource && this.path.equals(((PathResource) other).path))); }
/** * This implementation compares the underlying Path references. */ @Override public boolean equals(Object other) { return (this == other || (other instanceof PathResource && this.path.equals(((PathResource) other).path))); }
@Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { if (!dir.equals(path)) { deleteDirectoryImpl(dir); } return FileVisitResult.CONTINUE; } }
@Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { if (!dir.equals(path)) { deleteDirectoryImpl(dir); } return FileVisitResult.CONTINUE; } }
@Override public boolean equals(Object other) { if (other instanceof LocallyCachedTopologyBlob) { LocallyCachedTopologyBlob o = (LocallyCachedTopologyBlob) other; return topologyId.equals(o.topologyId) && type == o.type && topologyBasicBlobsRootDir.equals(o.topologyBasicBlobsRootDir); } return false; }
@Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { if (!dir.equals(directory)) { Files.delete(dir); } return FileVisitResult.CONTINUE; } });
private @CheckForNull Path getDirectChild(Path parentPath, String childPath){ Path current = parentPath.resolve(childPath); while (current != null && !parentPath.equals(current.getParent())) { current = current.getParent(); } return current; } }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ResourcePath that = (ResourcePath) o; if (rClass != null ? !rClass.equals(that.rClass) : that.rClass != null) return false; if (resourceBase != null ? !resourceBase.equals(that.resourceBase) : that.resourceBase != null) return false; if (assetsDir != null ? !assetsDir.equals(that.assetsDir) : that.assetsDir != null) return false; return internalRClass != null ? internalRClass.equals(that.internalRClass) : that.internalRClass == null; }
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (file.toFile().isDirectory()) { deleteDirectoryImpl(file); } else if (!symLink || !file.equals(path)) { Files.delete(file); } return FileVisitResult.CONTINUE; }
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (file.toFile().isDirectory()) { deleteDirectoryImpl(file); } else if (!symLink || !file.equals(path)) { Files.delete(file); } return FileVisitResult.CONTINUE; }
@Override public Stream<Path> loadAll() { try { return Files.walk(rootLocation, 1) .filter(path -> !path.equals(rootLocation)) .map(path -> rootLocation.relativize(path)); } catch (IOException e) { throw new RuntimeException("Failed to read stored files", e); } }
@Override public FileVisitResult visitFile(Path filePath, BasicFileAttributes attrs) throws IOException { File file = filePath.toFile(); if (file.isDirectory()) { deleteDirectory(file); } else if (filePath.getFileName().equals(SHAREDMEMORY_FILE)) { return CONTINUE; } else if (!symLink || !filePath.equals(path)) { Files.delete(filePath); } return CONTINUE; }
private File jarInCache(String pluginKey, String hash) { File hashDir = new File(cacheDir, hash); File file = new File(hashDir, format("sonar-%s-plugin.jar", pluginKey)); if (!file.getParentFile().toPath().equals(hashDir.toPath())) { // vulnerability - attempt to create a file outside the cache directory throw new IllegalStateException(format("Fail to download plugin [%s]. Key is not valid.", pluginKey)); } return file; }
/** * Filters away the {@code rootDir}. * * @return this */ public DirectoryWalker filterRoot() { filter(path -> !path.equals(rootDir)); return this; }
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof LayerEntry)) { return false; } LayerEntry otherLayerEntry = (LayerEntry) other; return sourceFile.equals(otherLayerEntry.sourceFile) && extractionPath.equals(otherLayerEntry.extractionPath) && Objects.equals(permissions, otherLayerEntry.permissions); }
@Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { if (!dir.equals(path)) { deleteDirectory(dir.toFile()); } return CONTINUE; } }
@Override public boolean equals(Object other) { if (other instanceof LocalizedResource) { LocalizedResource l = (LocalizedResource) other; return getKey().equals(l.getKey()) && shouldUncompress == l.shouldUncompress && baseDir.equals(l.baseDir); } return false; }
public void assertIsNormalized(final AssertionInfo info, final Path actual) { assertNotNull(info, actual); if (!actual.normalize().equals(actual)) throw failures.failure(info, shouldBeNormalized(actual)); }
public void assertIsCanonical(final AssertionInfo info, final Path actual) { assertNotNull(info, actual); try { if (!actual.equals(actual.toRealPath())) throw failures.failure(info, shouldBeCanonicalPath(actual)); } catch (IOException e) { throw new PathsException(FAILED_TO_RESOLVE_ACTUAL_REAL_PATH, e); } }
public void assertHasParentRaw(final AssertionInfo info, final Path actual, final Path expected) { assertNotNull(info, actual); checkExpectedParentPathIsNotNull(expected); final Path actualParent = actual.getParent(); if (actualParent == null) throw failures.failure(info, shouldHaveParent(actual, expected)); if (!actualParent.equals(expected)) throw failures.failure(info, shouldHaveParent(actual, actualParent, expected)); }