Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

DefaultRedisList.get(int) does not reject an index equal to the list size

Open Beginner friendly
#3,471 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 5 days

@ryujungkyun is already working on this.

Since Oct 15, 2026.

  • #3470 by @ryujungkyun — open

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java, redis
Domain
databases

Research direction

Start with the get(int) method in DefaultRedisList, where the bounds check uses index > size() and should reject index >= size(). Check the linked related PR #3470 first, since it may already contain this fix. Add or run unit tests with mocked BoundListOperations for get(size) and get(0) on an empty list. Done when both throw IndexOutOfBoundsException and the existing valid-index tests still pass.

Written by the indexing model from the issue text.

Description

status: waiting-for-triage
Description

DefaultRedisList.get(int) does not throw IndexOutOfBoundsException when the index equals the list size, contrary to the List.get(int) contract.

The current bounds check uses index > size() instead of index >= size(). This allows an invalid index to reach the underlying Redis operation.

Example

Given a list containing [A, B, C]:

Call Expected result
get(0) A
get(2) C
get(3) IndexOutOfBoundsException

The same issue occurs when calling get(0) on an empty list.

Steps to reproduce
  1. Create a DefaultRedisList containing three elements.
  2. Call get(3).
  3. Observe that the expected IndexOutOfBoundsException is not thrown.

Alternatively, create an empty list and call get(0).

Expected behavior

get(int) should throw IndexOutOfBoundsException when index < 0 or index >= size().

Actual behavior

An index equal to size() passes the bounds check and is forwarded to BoundListOperations.index(...) without throwing the expected exception.

Verification

Added unit tests using mocked BoundListOperations:

  • Reading index 0 from an empty list: fails because no exception is thrown.
  • Reading index 3 from a list of size 3: fails because no exception is thrown.
  • Reading index 2 from a list of size 3: passes.

After changing the upper-bound check to index >= size(), all three tests pass.

Environment
  • Spring Data Redis: 4.2.0-SNAPSHOT
  • Java: 21

Related PR: #3470

Dominant language
Java
Stars
1.9k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from spring-projects/spring-data-redis

All issues in spring-projects/spring-data-redis

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.