Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Trimming Whitespace In setAccessToken() #2950

Closed
wants to merge 1 commit into from

Conversation

bleege
Copy link
Contributor

@bleege bleege commented Nov 5, 2015

Closes #2919

@bleege bleege added the Android Mapbox Maps SDK for Android label Nov 5, 2015
@bleege bleege added this to the android-v2.3.0 milestone Nov 5, 2015
@@ -1563,6 +1563,9 @@ private void validateAccessToken(String accessToken) {
@UiThread
public void setAccessToken(@NonNull String accessToken) {
// validateAccessToken does the null check
if (!TextUtils.isEmpty(accessToken)) {
accessToken = accessToken.trim();
Copy link
Contributor

Choose a reason for hiding this comment

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

To catch all-whitespace tokens, trim first then ask questions later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotta do a Null check first (which is what TextUtils.isEmpty() is doing). If not when a null shows up the trim will crash things.

@bleege
Copy link
Contributor Author

bleege commented Nov 5, 2015

Rebased and merged.

@bleege bleege closed this Nov 5, 2015
@bleege bleege deleted the 2919-trim-the-access-token branch November 5, 2015 23:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants