Skip to content

Status.fromCodeValue(17) throws java.lang.IndexOutOfBoundsException #10142

@colinmeek-db

Description

@colinmeek-db

Manually reopening locked issue #2237, which was marked as fixed with #2238, a change that did not modify the offending method.

What version of gRPC-Java are you using?

1.48.2

What is your environment?

n/a (straightforward off-by-one bug)

What did you expect to see?

Status.Code.UNKNOWN.withDescription("Unknown code 17")

What did you see instead?

  java.lang.IndexOutOfBoundsException: Index 17 out of bounds for length 17
  at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
  at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
  at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
  at java.base/java.util.Objects.checkIndex(Objects.java:372)
  at java.base/java.util.ArrayList.get(ArrayList.java:459)
  at java.base/java.util.Collections$UnmodifiableList.get(Collections.java:1310)
  at io.grpc.Status.fromCodeValue(Status.java:309)

Steps to reproduce the bug

Status error = Status.fromCodeValue(17);

See stack trace above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions