@@ -85,7 +85,8 @@ public void assertNonExisting(CryptoPath cleartextPath) throws FileAlreadyExists
85
85
/**
86
86
* @param cleartextPath A path
87
87
* @return The file type for the given path (if it exists)
88
- * @throws NoSuchFileException If no node exists at the given path for any known type
88
+ * @throws NoSuchFileException If the ciphertext path does not exist
89
+ * @throws InvalidFileNodeException If the node points to a ciphertext directory, which does not contain an identification file
89
90
* @throws IOException
90
91
*/
91
92
public CiphertextFileType getCiphertextFileType (CryptoPath cleartextPath ) throws NoSuchFileException , IOException {
@@ -105,7 +106,7 @@ public CiphertextFileType getCiphertextFileType(CryptoPath cleartextPath) throws
105
106
} else {
106
107
eventConsumer .accept (new BrokenFileNodeEvent (cleartextPath , ciphertextPath .getRawPath ()));
107
108
LOG .warn ("Did not find valid content inside of {}" , ciphertextPath .getRawPath ());
108
- throw new NoSuchFileException (cleartextPath .toString (), null , "Could not determine type of file " + ciphertextPath .getRawPath ());
109
+ throw new InvalidFileNodeException (cleartextPath .toString (), ciphertextPath .getRawPath (). toString ());
109
110
}
110
111
} else {
111
112
// assume "file" if not a directory (even if it isn't a "regular" file, see issue #81):
@@ -117,7 +118,7 @@ public CiphertextFileType getCiphertextFileType(CryptoPath cleartextPath) throws
117
118
public CiphertextFilePath getCiphertextFilePath (CryptoPath cleartextPath ) throws IOException {
118
119
CryptoPath parentPath = cleartextPath .getParent ();
119
120
if (parentPath == null ) {
120
- throw new IllegalArgumentException ("Invalid file path (must have a parent): " + cleartextPath ); //TODO: cleartext path in Logs!
121
+ throw new IllegalArgumentException ("Invalid file path (must have a parent): " + cleartextPath );
121
122
}
122
123
CiphertextDirectory parent = getCiphertextDir (parentPath );
123
124
String cleartextName = cleartextPath .getFileName ().toString ();
0 commit comments