-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: The last added folder defines progress monitor total work in asynchronous zipping task #313
Comments
First of all, thank you for the detailed analysis and explanation of the issue. It makes it much easier to investigate/discuss with such explanation. This is an interesting scenario you have mentioned. I need to play around a bit to find a solution for this. I will consider your proposal as well, and get back soon when I have more information. |
The actual bug here is that it is (or was before my fix) possible to call |
Great. Thanks a lot. |
Fixed in v2.8.0 released today. |
Hello,
I think I found a bug when adding multiple folders for asynchronous zipping. The last added folder sets the total work to be done. So the information about the running zip task is not correct in terms of percentage done.
At first the example corresponding to the documentation:
Here the problem: Adding a folder resets the total work to be done (see line 28 AsyncZipTask.java). The method
calculateTotalWork(taskParameters)
is defined through AddFolderToZipTask.java. There you can see that the total work corresponds to the size of all files inside only this folder. It is not accumulated. Therefore, the last folder defines the total work to be done and the percentage is not correct.Here a solution proposal: Just accumulating the work to be done might lead to strange effects because adding a folder increases the total work to be done and decreases the percentage. So instead create an
AccumulatedProgressMonitor
class which derives from theProgressMonitor
and allows to combine the state of multiple progress monitors into this single class. Then thisAccumulatedProgressMonitor
could be returned from the ZipFile class instead of theProgressMonitor
. Thus, there would be no interface break. Additionally each call to addFolder/addFile/addStream should return theProgressMonitor
for this zipping operation. In that way the user could also create an ownAccumulatedProgressMonitor
accumulating only specific operations. I did not think about the states but it might work ;)The text was updated successfully, but these errors were encountered: