Document is in disposed state! - setting a Document workflow variable | Community
Skip to main content
crich2784
Level 6
January 17, 2022
Solved

Document is in disposed state! - setting a Document workflow variable

  • January 17, 2022
  • 1 reply
  • 1270 views

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,

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by crich2784

This should work. not sure why it is not working for you. 

As an alternative can you try with this:

 

 

byte[] bytes = <create byte[] from file>
Document inDoc = new Document(bytes);

 

 


@mayank_tiwari I logged a support case and it was reported that this is a known bug.  My case number is 000538536  - check with Manish Pandey if interested.

1 reply

Mayank_Tiwari
Adobe Employee
Adobe Employee
January 18, 2022

Can you try the following code. This has been used in this sample code as well.

 

import java.io.File; import com.adobe.aemfd.docmanager.Document; String inputFile = "<path to a pdf document stored at disk>" File inFile = new File(inputFile); Document inDoc = new Document(inFile);

 

crich2784
crich2784Author
Level 6
January 18, 2022

This did not work.  Same error . . . shall I open a bug?

Mayank_Tiwari
Adobe Employee
Adobe Employee
January 21, 2022

This should work. not sure why it is not working for you. 

As an alternative can you try with this:

 

 

byte[] bytes = <create byte[] from file>
Document inDoc = new Document(bytes);