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

Fix empty token handling in RawAuthResponse constructor #505

Conversation

hpark-miovision
Copy link
Contributor

RawAuthResponse constructor first checks to ensure provided token is not null and is not empty. Existing implementation used != operator to detect non-empty string, thus failed to handle when provided token is actually empty, i.e. "".

The token comparison logic in RawAuthResponse constructor is now updated to use isEmpty() instead, more specifically, (token != null && !token.isEmpty()) to properly handle "" case.

New test case with sample json has been added for validation; the test prior to the change would fail with java.lang.ArrayIndexOutOfBoundsException.

RawAuthResponse constructor first checks to ensure provided token is not null and is not empty. Existing implementation used != operator to detect non-empty string, thus failed to handle when provided token is actually empty, i.e. "".

The token comparison logic in RawAuthResponse constructor is now updated to use isEmpty() instead, more specifically, (token != null && !token.isEmpty()) to properly handle "" case.

New test case with sample json has been added for validation; the test prior to the change would fail with java.lang.ArrayIndexOutOfBoundsException.
@hpark-miovision hpark-miovision requested a review from a team as a code owner May 9, 2024 02:25
@nmayorsplit nmayorsplit changed the base branch from development to Feature/Semver May 14, 2024 21:01
@nmayorsplit nmayorsplit merged commit cda3711 into splitio:Feature/Semver May 14, 2024
2 of 3 checks passed
@hpark-miovision hpark-miovision deleted the handle_auth_response_with_empty_token branch May 14, 2024 21:22
@nmayorsplit
Copy link
Contributor

Thank you @hpark-miovision for the suggestion.
We have released Java 4.12.0 and this change was added.

Thanks,

Nadia

@hpark-miovision
Copy link
Contributor Author

Thank you very much @nmayorsplit for the update! We're using the splitio/java-client for integration with Split Proxy (https://help.split.io/hc/en-us/articles/4415960499213-Split-Proxy), and newer version should allow us to utilize auth endpoint of proxy as well.

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