Skip to content

Commit

Permalink
fix(artifacts): Fix NPE on empty artifact (#373)
Browse files Browse the repository at this point in the history
If an artifact is empty, we throw an NPE when downloading it
rather than just pass an empty artifact along to the caller.

In general it's not overly useful to have an empty artifact, but
in some cases (ex: a values.yaml file for a Helm bake) it's reasonable
to have no content.
  • Loading branch information
ezimanyi committed May 17, 2019
1 parent 0ababe1 commit a8d60cb
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ protected Path downloadArtifactToTmpFile(BakeManifestEnvironment env, Artifact a

Response response = retrySupport.retry(() -> clouddriverService.fetchArtifact(artifact), 5, 1000, true);

InputStream inputStream = response.getBody().in();
IOUtils.copy(inputStream, outputStream);
inputStream.close();
if (response.getBody() != null) {
InputStream inputStream = response.getBody().in();
IOUtils.copy(inputStream, outputStream);
inputStream.close();
}
outputStream.close();

return path;
Expand Down

0 comments on commit a8d60cb

Please sign in to comment.