Skip to content
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

Don't fail if an error response is missing during publishing #699

Merged
merged 1 commit into from
May 17, 2022
Merged

Don't fail if an error response is missing during publishing #699

merged 1 commit into from
May 17, 2022

Conversation

NathanHowell
Copy link
Contributor

@NathanHowell NathanHowell commented May 10, 2022

HttpURLConnection.getErrorStream is allowed to return null, and when this happens an NPE is raised:

INFO: Uploading to https://...
Exception in thread "main" java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2022)
	at rules.jvm.external.maven.MavenPublisher.main(MavenPublisher.java:99)
Caused by: java.lang.NullPointerException
	at rules.jvm.external.ByteStreams.copy(ByteStreams.java:26)
	at rules.jvm.external.ByteStreams.toByteArray(ByteStreams.java:18)
	at rules.jvm.external.maven.MavenPublisher.lambda$httpUpload$1(MavenPublisher.java:219)
	at rules.jvm.external.maven.MavenPublisher.lambda$upload$0(MavenPublisher.java:182)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

HttpURLConnection.getErrorStream is allowed to return null, and when this happens an NPE is raised:

INFO: Uploading to https://...
Exception in thread "main" java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2022)
	at rules.jvm.external.maven.MavenPublisher.main(MavenPublisher.java:99)
Caused by: java.lang.NullPointerException
	at rules.jvm.external.ByteStreams.copy(ByteStreams.java:26)
	at rules.jvm.external.ByteStreams.toByteArray(ByteStreams.java:18)
	at rules.jvm.external.maven.MavenPublisher.lambda$httpUpload$1(MavenPublisher.java:219)
	at rules.jvm.external.maven.MavenPublisher.lambda$upload$0(MavenPublisher.java:182)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
@jin
Copy link
Member

jin commented May 17, 2022

thanks!

@jin jin merged commit 9755ea2 into bazelbuild:master May 17, 2022
@NathanHowell NathanHowell deleted the allow-empty-error-response branch May 17, 2022 07:26
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.

None yet

2 participants