Skip to content

Conversation

danielsoro
Copy link
Contributor

Before Quarkus 3.28, when we defined a wrong scope, Quarkus added a warning log to indicate that it wasn't possible to use the defined scope for the RestClient and initialize the Client with the default scope. With the current version, it is returning a NullPointerException, and no warning is thrown.

This change fixes the issue and adds a warning about it during the build.

@danielsoro danielsoro changed the title fix: RestClient processor with NullPointerException during scope definition RestClient processor with NullPointerException during scope definition Oct 2, 2025
@danielsoro danielsoro force-pushed the fix-rest-scope-definition branch from 1fca2ca to f9efe85 Compare October 2, 2025 23:41
@gastaldi gastaldi requested a review from geoand October 2, 2025 23:43
@geoand
Copy link
Contributor

geoand commented Oct 3, 2025

Thanks for this!

It would be nice to have a test that would have failed with the existing version of the code, but that passes with this fix

@danielsoro danielsoro force-pushed the fix-rest-scope-definition branch from f9efe85 to fbe239e Compare October 3, 2025 11:20
@danielsoro
Copy link
Contributor Author

danielsoro commented Oct 3, 2025

Thanks for this!

It would be nice to have a test that would have failed with the existing version of the code, but that passes with this fix

@geoand Added test for it. Just to make sure that when we define some wrong-scope it shouldn't return a NPE, but should apply the default scope.

This comment has been minimized.

This comment has been minimized.

Copy link

github-actions bot commented Oct 3, 2025

🎊 PR Preview 021b167 has been successfully built and deployed to https://quarkus-pr-main-50398-preview.surge.sh/version/main/guides/

  • Images of blog posts older than 3 months are not available.
  • Newsletters older than 3 months are not available.

@danielsoro danielsoro force-pushed the fix-rest-scope-definition branch 2 times, most recently from e7e1fe7 to 23db9a7 Compare October 3, 2025 14:18

This comment has been minimized.

This comment has been minimized.

@geoand
Copy link
Contributor

geoand commented Oct 3, 2025

I'm actually wondering whether we should fail the build instead in these cases... WDYT @gsmet ?

@danielsoro
Copy link
Contributor Author

I'm actually wondering whether we should fail the build instead in these cases... WDYT @gsmet ?

Any update about it?

@geoand
Copy link
Contributor

geoand commented Oct 8, 2025

We are at a conference this week so responses will be delayed 😉

@gsmet
Copy link
Member

gsmet commented Oct 9, 2025

I'm actually wondering whether we should fail the build instead in these cases...

I'm on the verge of it. Warnings are easy to miss and this could have consequences so yeah maybe throwing an error is safer.

@danielsoro as a user, what's your take on this?

Maybe our CDI people will have a strong opinion about it? /cc @mkouba @Ladicek @manovotn

@Ladicek
Copy link
Contributor

Ladicek commented Oct 9, 2025

I'm not sure how the NPE looks like, but a NPE is usually not intentional, so that sounds like a bug.

I'm not sure if we "validate" a scope anywhere else in Quarkus (maybe we do, I just can't remember at the moment), but changing a scope in case the declared one is invalid seems like a bad idea. I'm +1 on turning that into an error.

@danielsoro
Copy link
Contributor Author

Yes, in the past, a warning was present instead of an error, which is why I kept it the same way.

However, it makes sense to throw an exception; the feedback is much clearer.
I'll take a look at it later.

@danielsoro danielsoro force-pushed the fix-rest-scope-definition branch from 23db9a7 to 5c14746 Compare October 9, 2025 16:40
@danielsoro danielsoro force-pushed the fix-rest-scope-definition branch from 5c14746 to 4869013 Compare October 9, 2025 16:42
@mkouba
Copy link
Contributor

mkouba commented Oct 10, 2025

+1 for a build failure.

Copy link
Contributor

@manovotn manovotn left a comment

Choose a reason for hiding this comment

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

LGTM
Also 👍 for making it an error to declare wrong scope

Copy link
Contributor

@geoand geoand left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link

quarkus-bot bot commented Oct 10, 2025

Status for workflow Quarkus Documentation CI

This is the status report for running Quarkus Documentation CI on commit 4869013.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

Warning

There are other workflow runs running, you probably need to wait for their status before merging.

Copy link
Contributor

@Ladicek Ladicek left a comment

Choose a reason for hiding this comment

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

From the added tests, I take it the RESTEasy Reactive client already failed with an exception if an invalid scope was configured? And the change here to RESTEasy classic "just" unifies the behavior? If so, even better! Thanks!

Copy link

quarkus-bot bot commented Oct 10, 2025

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 4869013.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.

@geoand geoand merged commit 1d2914a into quarkusio:main Oct 13, 2025
40 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.29 - main milestone Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants