Skip to content

Commit 8167d5d

Browse files
committed
Rename method and improve doc
1 parent 971c1a8 commit 8167d5d

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ public abstract class CryptoFileSystem extends FileSystem {
3535
*
3636
* @param cleartextPath absolute path to the cleartext file or folder belonging to this {@link CryptoFileSystem}. Internally the path must be an instance of {@link CryptoPath}
3737
* @return the {@link Path} to ciphertext file or folder containing teh actual encrypted data
38-
* @throws IOException
38+
* @throws java.nio.file.ProviderMismatchException if the cleartext path does not belong to this CryptoFileSystem
39+
* @throws java.nio.file.NoSuchFileException if for the cleartext path no ciphertext resource exists
40+
* @throws IOException if an I/O error occurs looking for the ciphertext resource
3941
*/
40-
public abstract Path getPathToDataCiphertext(Path cleartextPath) throws IOException;
42+
public abstract Path getCiphertextPath(Path cleartextPath) throws IOException;
4143

4244
/**
4345
* Provides file system performance statistics.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public Path getPathToVault() {
137137
}
138138

139139
@Override
140-
public Path getPathToDataCiphertext(Path cleartextPath) throws IOException {
140+
public Path getCiphertextPath(Path cleartextPath) throws IOException {
141141
var p = CryptoPath.castAndAssertAbsolute(cleartextPath);
142142
var nodeType = cryptoPathMapper.getCiphertextFileType(p);
143143
var cipherFile = cryptoPathMapper.getCiphertextFilePath(p);

src/test/java/org/cryptomator/cryptofs/CryptoFileSystemImplTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public void testCleartextDirectory() throws IOException {
202202
when(cryptoPathMapper.getCiphertextFileType(any())).thenReturn(CiphertextFileType.DIRECTORY);
203203
when(cryptoPathMapper.getCiphertextDir(any())).thenReturn(new CiphertextDirectory("foo", ciphertext));
204204

205-
Path result = inTest.getPathToDataCiphertext(cleartext);
205+
Path result = inTest.getCiphertextPath(cleartext);
206206
Assertions.assertEquals(ciphertext, result);
207207
}
208208
}
@@ -219,7 +219,7 @@ public void testCleartextFile() throws IOException {
219219
when(cryptoPathMapper.getCiphertextFilePath(any())).thenReturn(p);
220220
when(p.getFilePath()).thenReturn(ciphertext);
221221

222-
Path result = inTest.getPathToDataCiphertext(cleartext);
222+
Path result = inTest.getCiphertextPath(cleartext);
223223
Assertions.assertEquals(ciphertext, result);
224224
}
225225
}
@@ -236,7 +236,7 @@ public void testCleartextSymlink() throws IOException {
236236
when(cryptoPathMapper.getCiphertextFilePath(any())).thenReturn(p);
237237
when(p.getSymlinkFilePath()).thenReturn(ciphertext);
238238

239-
Path result = inTest.getPathToDataCiphertext(cleartext);
239+
Path result = inTest.getCiphertextPath(cleartext);
240240
Assertions.assertEquals(ciphertext, result);
241241
}
242242
}
@@ -245,7 +245,7 @@ public void testCleartextSymlink() throws IOException {
245245
@DisplayName("Path not pointing into the vault throws exception")
246246
public void testForeignPathThrows() throws IOException {
247247
Path cleartext = Mockito.mock(Path.class, "/some.file");
248-
Assertions.assertThrows(ProviderMismatchException.class, () -> inTest.getPathToDataCiphertext(cleartext));
248+
Assertions.assertThrows(ProviderMismatchException.class, () -> inTest.getCiphertextPath(cleartext));
249249
}
250250

251251
@Test
@@ -256,7 +256,7 @@ public void testNoSuchFile() throws IOException {
256256
cryptoPathMock.when(() -> CryptoPath.castAndAssertAbsolute(any())).thenReturn(cleartext);
257257
when(cryptoPathMapper.getCiphertextFileType(any())).thenThrow(new NoSuchFileException("no such file"));
258258

259-
Assertions.assertThrows(NoSuchFileException.class, () -> inTest.getPathToDataCiphertext(cleartext));
259+
Assertions.assertThrows(NoSuchFileException.class, () -> inTest.getCiphertextPath(cleartext));
260260
}
261261
}
262262

@@ -267,7 +267,7 @@ public void testRelativePathException() throws IOException {
267267
try (var cryptoPathMock = Mockito.mockStatic(CryptoPath.class)) {
268268
cryptoPathMock.when(() -> CryptoPath.castAndAssertAbsolute(any())).thenThrow(new IllegalArgumentException());
269269

270-
Assertions.assertThrows(IllegalArgumentException.class, () -> inTest.getPathToDataCiphertext(cleartext));
270+
Assertions.assertThrows(IllegalArgumentException.class, () -> inTest.getCiphertextPath(cleartext));
271271
}
272272
}
273273
}

0 commit comments

Comments
 (0)