use of net.viperfish.journal.framework.errors.CannotClearPasswordException in project vsDiaryWriter by shilongdai.
the class OpenBSDBCryptAuthManager method clear.
/**
* clears the content of the password file
*
* This method clears the content of the password file by writing an empty
* string to the file.
*
* @throws CannotClearPasswordException
* if failed to write an empty string
*/
@Override
public synchronized void clear() throws CannotClearPasswordException {
try {
passwdFile.write("", StandardCharsets.US_ASCII);
this.current = null;
this.password = null;
} catch (IOException e) {
CannotClearPasswordException cp = new CannotClearPasswordException("Failed to clear password stored in the file:" + passwdFile.getFile() + ", message:" + e.getMessage());
cp.initCause(e);
throw cp;
}
}
Aggregations