Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

String component not working #1239

Copy link
Copy link
@piotrooo

Description

@piotrooo
Issue body actions

For a simple StringInput component like this:

@Component
public class SimpleComponents {
    private final Terminal terminal;

    public SimpleComponents(Terminal terminal) {
        this.terminal = terminal;
    }

    @Command(name = "string")
    public String string() {
        StringInput stringInput = new StringInput(terminal, "Simple string", "<default>");
        StringInputContext stringInputContext = stringInput.run(StringInputContext.empty());
        return "Value: " + stringInputContext.getResultValue();
    }
}

I get the following exception when running the command:

org.springframework.shell.core.command.CommandExecutionException: Unable to execute command string
	at org.springframework.shell.core.command.CommandExecutor.execute(CommandExecutor.java:74)
	at org.springframework.shell.core.InteractiveShellRunner.run(InteractiveShellRunner.java:99)
	at org.springframework.shell.core.autoconfigure.ShellRunnerAutoConfiguration.lambda$springShellApplicationRunner$0(ShellRunnerAutoConfiguration.java:41)
	at org.springframework.boot.SpringApplication.lambda$callRunner$0(SpringApplication.java:788)
	at org.springframework.util.function.ThrowingConsumer$1.acceptWithException(ThrowingConsumer.java:82)
	at org.springframework.util.function.ThrowingConsumer.accept(ThrowingConsumer.java:60)
	at org.springframework.util.function.ThrowingConsumer$1.accept(ThrowingConsumer.java:86)
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:800)
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:788)
	at org.springframework.boot.SpringApplication.lambda$callRunners$0(SpringApplication.java:776)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:186)
	at java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:571)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:153)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:176)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:632)
	at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:776)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:328)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1365)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354)
	at com.example.ComponentsApplication.main(ComponentsApplication.java:9)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:565)
	at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:106)
	at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:64)
	at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:40)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
	at java.base/java.lang.reflect.Method.invoke(Method.java:565)
	at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:275)
	at org.springframework.shell.core.command.adapter.MethodInvokerCommandAdapter.doExecute(MethodInvokerCommandAdapter.java:102)
	at org.springframework.shell.core.command.AbstractCommand.execute(AbstractCommand.java:151)
	at org.springframework.shell.core.command.CommandExecutor.execute(CommandExecutor.java:71)
	... 27 more
Caused by: java.lang.IllegalArgumentException: 'resourceLoader' must not be null
	at org.springframework.util.Assert.notNull(Assert.java:182)
	at org.springframework.shell.jline.tui.component.support.AbstractComponent.renderTemplateResource(AbstractComponent.java:223)
	at org.springframework.shell.jline.tui.component.StringInput.access$000(StringInput.java:42)
	at org.springframework.shell.jline.tui.component.StringInput$DefaultRenderer.apply(StringInput.java:328)
	at org.springframework.shell.jline.tui.component.StringInput$DefaultRenderer.apply(StringInput.java:324)
	at org.springframework.shell.jline.tui.component.support.AbstractComponent.render(AbstractComponent.java:133)
	at org.springframework.shell.jline.tui.component.support.AbstractComponent.loop(AbstractComponent.java:295)
	at org.springframework.shell.jline.tui.component.support.AbstractTextComponent.runInternal(AbstractTextComponent.java:75)
	at org.springframework.shell.jline.tui.component.support.AbstractTextComponent.runInternal(AbstractTextComponent.java:41)
	at org.springframework.shell.jline.tui.component.support.AbstractComponent.run(AbstractComponent.java:168)
	at com.example.SimpleComponents.string(SimpleComponents.java:20)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	... 32 more

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.