Temp Files created by Aspose and how they are named

Hi we are getting the following java error when people are converting to pdf or combining pdfs.


java.io.IOException: GetOverlappedResult failed
The I/O operation has been aborted because of either a thread exit or an application request.
at java.lang.Object.wait(Native Method)

at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java)

at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java)

at sun.java2d.Disposer.run(Disposer.java)


This can possibly be caused by java looking for a temp file that no longer exists. We have multiple people carrying out conversions on a windows server and we would like to know is it possible that a temp file for one conversion could have the same name as a temp file for another conversion running at the same time?

These conversions are called by calling a batch file on the server.

Can you tell me how the temp file names are created?

Can you tell me is it possible to have these temp files created into different folder by setting an environment variable in the batch file?

e.g.

Person one calls batch file 1 where temp files are create in c:\a and person tow calls batch file 2 where temp files are created in c:\b

Thanks
Anthony


Hi Anthony,


Thank you for contacting support. Please provide us your sample code which you are using to convert documents to PDF or concatenating PDFs. It’ll help us to be more specific. In general, using Aspose.Words API, you can set the folder for temporary files used when saving to a DOC or DOCX file. By default, this property is null and no temporary files are used. It would be great if you can prepare a simple application project to demonstrate this error and share its zip archive in this forum thread for the testing purposes.

Hi Imran


For converting we are getting the document from a database and it is in a ByteArrayInputStream.

where currentDocument is a Document created using the ByteArrayInputStream if we are doing a Word type document and currentWorkBook is a WorkBook if we are doing a spreadsheet.

outputStream = new ByteArrayOutputStream();
formatDocConst = com.aspose.words.SaveFormat.PDF;
formatXLSConst = com.aspose.cells.SaveFormat.PDF;
if (saveType.equalsIgnoreCase(“WORDS”)) {
doDebug(“save new DOC outputstream”);
currentDocument.save(outputStream, formatDocConst);
} else if (saveType.equalsIgnoreCase(“CELLS”)) {
doDebug(“saving new XLS outputstream”);
currentWorkbook.save(outputStream, formatXLSConst);
}

We then take the outPutStream and send it back to the db.

For combining we are are again selecting a number of documents from a database and putting them into an array of ByteArrayInputStream.

Then where pdfEditor is a PdfFileEditor

pdfEditor.concatenate(inStreams, outStream);

We then save the outStream back to the db.

At all points we are using ByteArray streams. The temp files we see in c:\windows\temp are named like imageio3925255836694053250.tmp.

Unfortunately we cannot reproduce the error at will. It seems to be totally random. We are not even sure that the temp files are causing the issue but would like to know how they are named and if there is any possibility that 2 different running process could create temp files with the same name.

If would also be helpful if you could tell us how aspose decides where the temp folder is.


Thanks
Anthony


Hi Anthony,


Thank you for the details. Please list down the names of Aspose APIs along with the version number. We suspect that you are using old versions because the latest versions don’t generate temporary files in the folders. However, if you are using the old versions of Aspose APIs, then please download and use the latest APIs and let us know how that goes on your side. Please refer to the download section: http://www.aspose.com/downloads

Hi Imran

I have tried using the very latest jar files and the latest jre. I have found that if I have a document with an image in it the these imageio…tmp files are created in c:\windows\temp. I only tried .jpg images.

I assuming that these are created by java not necessarily by Aspose but I did find this old java bug.

http://bugs.java.com/view_bug.do?bug_id=4894964

Thanks

Anthony

Hi Anthony,


Thank you for the details. It might be correct. However, in the perspective of Aspose APIs, it is necessary for us to get your complete code (Aspose API related part) and source document to replicate the problem of temporary files at our end. Once the problem is replicated at our end, then we can further analyze its root cause. We appreciate your research and cooperation with us.