Document is in disposed state! - setting a Document workflow variable
We have written a custom workflow step. It has the following code. The idea is to set a Document variable to the value of a file from the filesystem.
Path filePath = Paths.get(path);
com.adobe.aemfd.docmanager.Document doc = new com.adobe.aemfd.docmanager.Document(Files.readAllBytes(filePath));
wfd.getMetaDataMap().put(documentVariableName, doc);
This succeeds however, we we attempt to use the Document variable, we get the error "Document is in a disposed state!".
How do I properly set a Document variable with the contents of a file on the filesystem?
Thanks,