@@ -85,7 +85,8 @@ public void assertNonExisting(CryptoPath cleartextPath) throws FileAlreadyExists
8585 /**
8686 * @param cleartextPath A path
8787 * @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
8990 * @throws IOException
9091 */
9192 public CiphertextFileType getCiphertextFileType (CryptoPath cleartextPath ) throws NoSuchFileException , IOException {
@@ -105,7 +106,7 @@ public CiphertextFileType getCiphertextFileType(CryptoPath cleartextPath) throws
105106 } else {
106107 eventConsumer .accept (new BrokenFileNodeEvent (cleartextPath , ciphertextPath .getRawPath ()));
107108 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 ());
109110 }
110111 } else {
111112 // 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
117118 public CiphertextFilePath getCiphertextFilePath (CryptoPath cleartextPath ) throws IOException {
118119 CryptoPath parentPath = cleartextPath .getParent ();
119120 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 );
121122 }
122123 CiphertextDirectory parent = getCiphertextDir (parentPath );
123124 String cleartextName = cleartextPath .getFileName ().toString ();
0 commit comments