[
https://issues.apache.org/jira/browse/KARAF-5887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16611119#comment-16611119
]
ASF GitHub Bot commented on KARAF-5887:
---------------------------------------
jbonofre closed pull request #602: [KARAF-5887] Fix NPE on ConsoleSessionImpl
URL: https://github.com/apache/karaf/pull/602
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
index 662cd50834..edbfb5bfdb 100644
---
a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
+++
b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
@@ -135,7 +135,15 @@ public ConsoleSessionImpl(SessionFactory factory,
}
// Create session
- session = processor.createSession(in, out, err);
+ if (in == null || out == null || err == null) {
+ session = processor.createSession(
+ jlineTerminal.input(),
+ jlineTerminal.output(),
+ jlineTerminal.output());
+ }
+ else {
+ session = processor.createSession(in, out, err);
+ }
// Completers
Completers.CompletionEnvironment env = new
Completers.CompletionEnvironment() {
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> NPE when starting karaf using bin/shell
> ---------------------------------------
>
> Key: KARAF-5887
> URL: https://issues.apache.org/jira/browse/KARAF-5887
> Project: Karaf
> Issue Type: Bug
> Components: karaf-shell
> Affects Versions: 4.1.6, 4.2.1
> Reporter: Nicolas Ottaviani
> Assignee: Jean-Baptiste Onofré
> Priority: Major
> Labels: shell
> Fix For: 4.2.2, 4.1.7
>
>
> When starting karaf using bin/shell, we have a NullPointerException
> {code:java}
> bin/shell "echo test"
> Exception in thread "main" java.lang.NullPointerException: "in" is null!
> at java.nio.channels.Channels.checkNotNull(Channels.java:67)
> at java.nio.channels.Channels.newChannel(Channels.java:347)
> at
> org.apache.felix.gogo.runtime.CommandSessionImpl.<init>(CommandSessionImpl.java:108)
> at
> org.apache.felix.gogo.runtime.CommandProcessorImpl.createSession(CommandProcessorImpl.java:82)
> at
> org.apache.felix.gogo.runtime.CommandProcessorImpl.createSession(CommandProcessorImpl.java:38)
> at
> org.apache.karaf.shell.impl.console.ConsoleSessionImpl.<init>(ConsoleSessionImpl.java:138)
> at
> org.apache.karaf.shell.impl.console.SessionFactoryImpl.create(SessionFactoryImpl.java:139)
> at
> org.apache.karaf.shell.impl.console.standalone.Main.createSession(Main.java:180)
> at org.apache.karaf.shell.impl.console.standalone.Main.run(Main.java:143)
> at org.apache.karaf.shell.impl.console.standalone.Main.run(Main.java:136)
> at org.apache.karaf.shell.impl.console.standalone.Main.run(Main.java:76)
> at org.apache.karaf.shell.impl.console.standalone.Main.main(Main.java:58)}}
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)