Hi,
I am using Aspose.Cells version 8.4.0 for Java. When I execute the code below, the workbook.save() call hangs forever. Also, the first line of code below takes about 40 seconds to execute. Why so slow?
//Create trivial WorkBook
Workbook workbook = new Workbook(FileFormatType.XLSX);//Takes 40 seconds to run this line in the IDE debugger
Worksheet worksheet = workbook.getWorksheets().add(“Search Results”);
worksheet.setZoom(100);
worksheet.getCells().get(1,1).setValue(“TESTING”);
InputStream in = new PipedInputStream();
try (PipedOutputStream out = new PipedOutputStream(in)) {
workbook.save(out, FileFormatType.XLSX); //Hangs here forever
…
}
Hi,
Thanks for your posting and using Aspose.Cells.
We were able to observe this issue after executing your sample code with the latest version: Aspose.Cells
for Java v8.4.2.5. When workbook is saved to piped output stream, it hangs forever.
We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.
This issue has been logged as
- CELLSJAVA-41367 - Saving Workbook with PipedOutputStream hangs forever
Hi,
We have evaluated your issue further.
Well, it is not an issue of Aspose.Cells. Please try the following sample code to evaluate your issue without involving Aspose.Cells APIs:
e.g
Sample code:
PipedInputStream in = new PipedInputStream();
PipedOutputStream out = new PipedOutputStream(in);
byte[] t = new byte[1000];
out.write(t);
in.read(t);//If this line is commented, it will hang forever.
t = new byte[1000];
out.write(t);
Please check the document about PipedInputStream/PipedOutputStream. If the number of input data is greater than the buffer’s size(the default value is 1024) of PipedInputStream, PipedOutputStream will hang and wait for other thread to read the data from PipedInputStream.
It’s better that the two classes should be in different threads.
Thanks for your understanding!