devonfw / IDEasy

Tool to automate the setup and updates of a development environment for any project (Successor of devonfw-ide).
Apache License 2.0
7 stars 18 forks source link

ProgressBar AssertionError, if content-length not set #130

Open moritzLanger opened 8 months ago

moritzLanger commented 8 months ago

Expected behavior

If a download does not provide a content length it should still be downloaded using the workaround show here.

Actual behavior

An assertion error will be thrown if the content length is not set and/or provided with the download. This error is throw in the IdeProgressBarTestImpl as it asserts that the total of the progress bar equals its max before closing, as can be seen here.

Steps to reproduce (bug) / Use Case of feature request (enhancement)

  1. Mock a server, which contains/downloads a File without specifing the Content length in the header
  2. Run the InstallCommandlet with the URL from the mocked server.

Affected version:

hohwille commented 6 months ago

Consider adding a method to complete the progressbar to our own API that can complete the progressbar (setting actual to max). Or as alternative create a dummy implementation that does not use the real progressbar if no content-length is available. If possible still give feedback to user of progress (x MB / ?).