No Content in FileDocument when accessing in Java

0
Dear, I have a FileDocument which I try to access within a Java Action. When I test the FileDocument in the Microflow if it has Content it returns true. If I test this in a java actions which is started by the same microflow it returns false. Also the stream returns 0 bytes. I have tried to copy the content from the FileDocument to a tempfile using the FileDocument.getContents() method and the tempfile stays empty. On the file systems I see the content of the FileDocument exists. So it should has content. Is there anyone who has some experience with this? Or should I report this as a bug? Boolean hasContent = new Boolean(false); this.File.setHasContents(hasContent); java.io.File tempFile = java.io.File.createTempFile("fileUpload", "tmp"); Core.getLogger(this.getClass().getName()).info("File info: " + File.getName() + " hasContent " + hasContent); this.File.getContents(getContext(), new FileOutputStream(tempFile)); Core.getLogger(this.getClass().getName()).info("temp location: " + Core.getConfiguration().getTempPath()); Thanks Kind Regards Erno
asked
2 answers
1

Using in getFileDocumentContent in ICore is preferred, that will get you an InputStream that you can copy to your tempfile.

answered
0

Not sure if something is wrong with that method. I tend to use: Core.getFileDocumentContent

answered