Skip to content

Fix 500 error when user has no data access token#11953

Open
Annu881 wants to merge 2 commits intocBioPortal:masterfrom
Annu881:fix-dat-empty-list
Open

Fix 500 error when user has no data access token#11953
Annu881 wants to merge 2 commits intocBioPortal:masterfrom
Annu881:fix-dat-empty-list

Conversation

@Annu881
Copy link

@Annu881 Annu881 commented Feb 11, 2026

  • Modified getDataAccessToken to check if token list is empty before accessing elements.
  • If the list is empty, create a new token is created instead of throwing an IndexOutOfBoundsException
  • Added test case testGetDataAccessTokenWhenNoTokensExist to verify correct behaviour when no token exist

Fixes #11905

Fix # (see https://help.github.com/en/articles/closing-issues-using-keywords)

Describe changes proposed in this pull request:

  • Modified the getDataAccessToken(String username) method in UuidDataAccessTokenServiceImpl.java to check if the list of tokens is empty before accessing elements
  • If the list is empty, the method now calls createDataAccessToken(username) to generate a new token
  • Added comprehensive test case testGetDataAccessTokenWhenNoTokensExist to verify the fix handles the empty token list scenario correctly.

Checks

  • [ x ] The commit log is comprehensible. It follows 7 rules of great commit messages. We can fix this during merge by using a squash+merge if necessary
  • [ x ] Has tests or has a separate issue that describes the types of test that should be created. If no test is included it should explicitly be mentioned in the PR why there is no test.
  • [ x ] Is this PR adding logic based on one or more clinical attributes? If yes, please make sure validation for this attribute is also present in the data validation / data loading layers (in backend repo) and documented in File-Formats Clinical data section!
  • [ x ] Make sure your PR has one of the labels defined in https://github.com/cBioPortal/cbioportal/blob/master/.github/release-drafter.yml

Any screenshots or GIFs?

Not applicable - this is a backend bug fix with no UI changes.

Notify reviewers

@inodb @mavwolverine

- Modified getDataAccessToken to check if token list is empty
- If empty, create a new token instead of throwing IndexOutOfBoundsException
- Added test case testGetDataAccessTokenWhenNoTokensExist to verify fix

Fixes cBioPortal#11905
@sonarqubecloud
Copy link

@dippindots dippindots self-requested a review February 17, 2026 16:22
@dippindots dippindots self-assigned this Feb 17, 2026
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.

[BUG] IndexOutOfBoundsException in UUID getDataAccessToken

2 participants