Document is in disposed state! - accessing a Document workflow variable
We have written a custom workflow step. It has the following code. The idea is to save a Document variable to the Payload directory.
In Java, we are trying to read in the Document variable.
Document doc = (Document) wfd.getMetaDataMap().get(docDataVariableName);
log.info("Document is a variable name: " + docDataVariableName);
log.info("Document information content type: " + doc.getContentType());
It fails when accessing doc.getContentType();
java.lang.IllegalStateException: Document is in a disposed state!
at com.adobe.aemfd.docmanager.Document.checkDisposed(Document.java:236) [adobe-aemds-core-docmanager:3.0.94]
at com.adobe.aemfd.docmanager.Document.getContentType(Document.java:383) [adobe-aemds-core-docmanager:3.0.94]
at com.s360g.aem.workflowcomponent.custom.saveDocumentToPayload.execute(saveDocumentToPayload.java:74) [com-s360g-aem-workflowcomponent.core:0.1.0.20220519201659008]
We have similar problems in other components too - all when accessing the Document variable from a workflow.
I had a previous post that says this was a bug in 6.5.9 - I have upgraded to 6.5.12 and still having the issue. I have opened a ticket: 000626337 but, I would love any feedback ahead of answering the ticket. It's a big blocker in our project.
Thanks,