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

IndexOutOfBoundsException in console-ui when header exceeds size of the terminal #1025

Closed
ddom75 opened this issue Jun 21, 2024 · 0 comments
Closed

Comments

@ddom75
Copy link

ddom75 commented Jun 21, 2024

When adding a header to a console-ui prompt, if the number of items in the header list is larger then the number of lines the terminal has to display, the program crashes. Here is the stack trace.

java.lang.IndexOutOfBoundsException: Index 74 out of bounds for length 5
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:266)
at java.base/java.util.Objects.checkIndex(Objects.java:361)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at org.jline.consoleui.prompt.AbstractPrompt.displayLines(AbstractPrompt.java:152)
at org.jline.consoleui.prompt.AbstractPrompt.refreshDisplay(AbstractPrompt.java:116)
at org.jline.consoleui.prompt.AbstractPrompt$InputValuePrompt.execute(AbstractPrompt.java:587)
at org.jline.consoleui.prompt.ConsolePrompt.prompt(ConsolePrompt.java:121)
at org.jline.consoleui.examples.Basic.main(Basic.java:175)

I've attached a modified Basic.java example to demonstrate the problem.
Basic.java.txt

@gnodet gnodet changed the title console-ui crash when header exceeds size of the terminal IndexOutOfBoundsException in console-ui when header exceeds size of the terminal Jul 3, 2024
@gnodet gnodet closed this as completed in 89db557 Jul 17, 2024
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

No branches or pull requests

1 participant