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

picocli-shell with jline3 throws StackOverflowError #640

Closed
vicasong opened this issue Jan 21, 2021 · 2 comments
Closed

picocli-shell with jline3 throws StackOverflowError #640

vicasong opened this issue Jan 21, 2021 · 2 comments

Comments

@vicasong
Copy link

I completely copied the example code to run the demo program, but the program throws an exception when I enter any command.

example code
relevant issue

  • Error
Invalid command: ?
java.lang.StackOverflowError
	at org.jline.utils.AttributedCharSequence.columnSplitLength(AttributedCharSequence.java:332)
	at org.jline.utils.AttributedCharSequence.columnSplitLength(AttributedCharSequence.java:324)
	at org.jline.reader.impl.LineReaderImpl.insertSecondaryPrompts(LineReaderImpl.java:4179)
	at org.jline.reader.impl.LineReaderImpl.insertSecondaryPrompts(LineReaderImpl.java:4174)
	at org.jline.reader.impl.LineReaderImpl.getDisplayedBufferWithPrompts(LineReaderImpl.java:4003)
	at org.jline.reader.impl.LineReaderImpl.redisplay(LineReaderImpl.java:3868)
	at org.jline.reader.impl.LineReaderImpl.doList(LineReaderImpl.java:5020)
	at org.jline.reader.impl.LineReaderImpl.clearChoices(LineReaderImpl.java:4993)
	at org.jline.reader.impl.LineReaderImpl.getDisplayedBufferWithPrompts(LineReaderImpl.java:4020)
	at org.jline.reader.impl.LineReaderImpl.redisplay(LineReaderImpl.java:3868)
	at org.jline.reader.impl.LineReaderImpl.doList(LineReaderImpl.java:5020)
	at org.jline.reader.impl.LineReaderImpl.clearChoices(LineReaderImpl.java:4993)
	at org.jline.reader.impl.LineReaderImpl.getDisplayedBufferWithPrompts(LineReaderImpl.java:4020)
	at org.jline.reader.impl.LineReaderImpl.redisplay(LineReaderImpl.java:3868)
	at org.jline.reader.impl.LineReaderImpl.doList(LineReaderImpl.java:5020)
	at org.jline.reader.impl.LineReaderImpl.clearChoices(LineReaderImpl.java:4993)
	at org.jline.reader.impl.LineReaderImpl.getDisplayedBufferWithPrompts(LineReaderImpl.java:4020)
	at org.jline.reader.impl.LineReaderImpl.redisplay(LineReaderImpl.java:3868)
	at org.jline.reader.impl.LineReaderImpl.doList(LineReaderImpl.java:5020)
	at org.jline.reader.impl.LineReaderImpl.clearChoices(LineReaderImpl.java:4993)
	at org.jline.reader.impl.LineReaderImpl.getDisplayedBufferWithPrompts(LineReaderImpl.java:4020)
	at org.jline.reader.impl.LineReaderImpl.redisplay(LineReaderImpl.java:3868)
	at org.jline.reader.impl.LineReaderImpl.doList(LineReaderImpl.java:5020)
	at org.jline.reader.impl.LineReaderImpl.clearChoices(LineReaderImpl.java:4993)
	at org.jline.reader.impl.LineReaderImpl.getDisplayedBufferWithPrompts(LineReaderImpl.java:4020)
	at org.jline.reader.impl.LineReaderImpl.redisplay(LineReaderImpl.java:3868)
	at org.jline.reader.impl.LineReaderImpl.doList(LineReaderImpl.java:5020)
	at org.jline.reader.impl.LineReaderImpl.clearChoices(LineReaderImpl.java:4993)
	at org.jline.reader.impl.LineReaderImpl.getDisplayedBufferWithPrompts(LineReaderImpl.java:4020)
	at org.jline.reader.impl.LineReaderImpl.redisplay(LineReaderImpl.java:3868)
	at org.jline.reader.impl.LineReaderImpl.doList(LineReaderImpl.java:5020)
	at org.jline.reader.impl.LineReaderImpl.clearChoices(LineReaderImpl.java:4993)
	at org.jline.reader.impl.LineReaderImpl.getDisplayedBufferWithPrompts(LineReaderImpl.java:4020)
	at org.jline.reader.impl.LineReaderImpl.redisplay(LineReaderImpl.java:3868)
	at org.jline.reader.impl.LineReaderImpl.doList(LineReaderImpl.java:5020)
	at org.jline.reader.impl.LineReaderImpl.clearChoices(LineReaderImpl.java:4993)
	at org.jline.reader.impl.LineReaderImpl.getDisplayedBufferWithPrompts(LineReaderImpl.java:4020)
<... etc....>
@mattirn
Copy link
Collaborator

mattirn commented Jan 21, 2021

You probably should add Jansi or JNA lib in your class path. See JLine README:

"On the Windows platform, relying on native calls is mandatory, so you need to have either Jansi or JNA library in your classpath along with the jline-terminal-jansi or jline-terminal-jna jar. Failing to do so will create a dumb terminal with no advanced capabilities."

Stackoverflow when using dumb terminal has been fixed in commit bb5e85a. You should use JLine version 3.18.0 or greater.

@vicasong
Copy link
Author

Thank you very much. The problem was solved after I upgraded the jline version.

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

2 participants