Skip to content

Save cause of download error for BuildException#3873

Merged
matthiasblaesing merged 1 commit intoapache:masterfrom
jgneff:save-first-problem
Mar 26, 2022
Merged

Save cause of download error for BuildException#3873
matthiasblaesing merged 1 commit intoapache:masterfrom
jgneff:save-first-problem

Conversation

@jgneff
Copy link
Copy Markdown
Contributor

@jgneff jgneff commented Mar 26, 2022

When downloading external binaries, save any IOException for the cause parameter of the BuildException. Otherwise, the root cause of the build failure is always null.

When downloading external binaries, save any IOException for the
'cause' parameter of the BuildException. Otherwise, the root cause
of the build failure is always null.
@jgneff
Copy link
Copy Markdown
Contributor Author

jgneff commented Mar 26, 2022

When the build fails to download an external binary because of an IOException, the root cause of the failure is always null. This pull request saves the exception so that it can be reported in the build error message.

Before

Before this change, the error is reported with a null root cause as shown below:

[downloadbinaries] Could not download
EC27...6746-wordlist-en_GB-large-2017.08.24.zip to
/root/.hgexternalcache/EC27...6746-wordlist-en_GB-large-2017.08.24.zip:
/build/.../parts/netbeans/build/nbbuild/build.xml:276:
  Could not download
  EC27...6746-wordlist-en_GB-large-2017.08.24.zip from
  https://netbeans.osuosl.org/binaries/: null

After

After this change, the original IOException is printed as the root cause:

[downloadbinaries] Could not download
EC27...6746-wordlist-en_GB-large-2017.08.24.zip to
/root/.hgexternalcache/EC27...6746-wordlist-en_GB-large-2017.08.24.zip:
/build/.../parts/netbeans/build/nbbuild/build.xml:276:
  Could not download
  EC27...6746-wordlist-en_GB-large-2017.08.24.zip from
  https://netbeans.osuosl.org/binaries/: java.io.IOException:
    Skipping download from
    https://netbeans.osuosl.org/binaries/EC27...6746-wordlist-en_GB-large-2017.08.24.zip
    due to response code 503

Now I see that the HTTPS proxy server in my build environment is returning a response status code of 503 Service Unavailable for this file:

The 503 (Service Unavailable) status code indicates that the server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay.

Tests

I ran the unit tests for the NetBeans Ant task downloadbinaries as follows:

$ ant -Dincludes=**/DownloadBinariesTest.class localtest
  ...
localtest:
    [junit] Testsuite: org.netbeans.nbbuild.extlibs.DownloadBinariesTest
    [junit] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.162 sec
    [junit]

BUILD SUCCESSFUL
Total time: 1 second

Copy link
Copy Markdown
Contributor

@vieiro vieiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @jgneff !

@matthiasblaesing
Copy link
Copy Markdown
Contributor

Thank you - looks good, unittests are green. Lets get this in.

@matthiasblaesing matthiasblaesing merged commit 73fb19b into apache:master Mar 26, 2022
@jgneff jgneff deleted the save-first-problem branch March 26, 2022 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants