Skip to content

Commit d653636

Browse files
infeooverheadhunter
andcommitted
Apply suggestions from code review
Co-authored-by: Sebastian Stenzel <overheadhunter@users.noreply.github.com>
1 parent 450c4b5 commit d653636

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

src/main/java/org/cryptomator/cryptofs/CryptoFileSystemImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import org.cryptomator.cryptofs.common.DeletingFileVisitor;
1919
import org.cryptomator.cryptofs.common.FinallyUtil;
2020
import org.cryptomator.cryptofs.dir.CiphertextDirectoryDeleter;
21-
import org.cryptomator.cryptofs.dir.ExcludeDirIdBackupFilter;
21+
import org.cryptomator.cryptofs.dir.DirectoryStreamFilters;
2222
import org.cryptomator.cryptofs.dir.DirectoryStreamFactory;
2323
import org.cryptomator.cryptofs.fh.OpenCryptoFiles;
2424
import org.cryptomator.cryptolib.api.Cryptor;
@@ -624,7 +624,7 @@ private void moveDirectory(CryptoPath cleartextSource, CryptoPath cleartextTarge
624624
// check if dir is empty:
625625
Path targetCiphertextDirContentDir = cryptoPathMapper.getCiphertextDir(cleartextTarget).path;
626626
boolean targetCiphertextDirExists = true;
627-
try (DirectoryStream<Path> ds = Files.newDirectoryStream(targetCiphertextDirContentDir, new ExcludeDirIdBackupFilter())) {
627+
try (DirectoryStream<Path> ds = Files.newDirectoryStream(targetCiphertextDirContentDir, DirectoryStreamFilters.EXCLUDE_DIR_ID_BACKUP)) {
628628
if (ds.iterator().hasNext()) {
629629
throw new DirectoryNotEmptyException(cleartextTarget.toString());
630630
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package org.cryptomator.cryptofs.dir;
2+
3+
import org.cryptomator.cryptofs.common.Constants;
4+
5+
import java.nio.file.DirectoryStream;
6+
import java.nio.file.Path;
7+
8+
public interface DirectoryStreamFilters {
9+
10+
static DirectoryStream.Filter<Path> EXCLUDE_DIR_ID_BACKUP = p -> !p.equals(p.resolveSibling(Constants.DIR_BACKUP_FILE_NAME));
11+
12+
}

src/main/java/org/cryptomator/cryptofs/dir/ExcludeDirIdBackupFilter.java

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)