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

NPE in CircuitBreaker, wrong null check #403

Closed
AbelPelser opened this issue Nov 21, 2023 · 2 comments
Closed

NPE in CircuitBreaker, wrong null check #403

AbelPelser opened this issue Nov 21, 2023 · 2 comments
Labels
Milestone

Comments

@AbelPelser
Copy link
Contributor

In CitcuitBreakerRetryPolicy:121 the performed null check checks the wrong member, it should check openTimeoutSupplier. This causes NPEs if resetTimeoutSupplier is not null but openTimeoutSupplier is, which happens if a @CircuitBreaker has a resetTimeoutExpression and no openTimeoutExpression.

@artembilan
Copy link
Member

Confirmed.
The code is like this:

		if (this.resetTimeoutSupplier != null) {
			resetTimeout = this.resetTimeoutSupplier.get();
		}
		long openTimeout = this.openTimeout;
		if (this.resetTimeoutSupplier != null) {
			openTimeout = this.openTimeoutSupplier.get();
		}

Which is really wrong.
Feel free to contribute the fix.

Thank you!

@AbelPelser
Copy link
Contributor Author

AbelPelser commented Nov 22, 2023

Done, see #404

@artembilan artembilan added this to the 2.0.5 milestone Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants