[ https://issues.apache.org/jira/browse/SSHD-570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14963275#comment-14963275 ]
Goldstein Lyor edited comment on SSHD-570 at 10/19/15 1:15 PM: --------------------------------------------------------------- Found the problem - the call to _exitValue_ comes *after* _destroy_ in _pumpStreams_ when exception occurs. The fix is simple - call _exitValue_ *before* _destroy_ and then use the value to exit via the callback. The bug was not detected so far since commands did not generate an exception in the inverted shell wrapper. was (Author: lgoldstein): Found the problem - fixing... > NPE while executing a command while redirecting > ----------------------------------------------- > > Key: SSHD-570 > URL: https://issues.apache.org/jira/browse/SSHD-570 > Project: MINA SSHD > Issue Type: Bug > Affects Versions: 1.0.0 > Environment: java version "1.7.0_85" > OpenJDK Runtime Environment (IcedTea 2.6.1) (Gentoo icedtea-7.2.6.1-r1) > OpenJDK 64-Bit Server VM (build 24.85-b03, mixed mode) > Reporter: Alon Bar-Lev > Assignee: Goldstein Lyor > Attachments: SSHD.java > > > Try to execute: > $ echo xxxx | ssh -p @PORT@ root@localhost "cat > /none/exist/path/file" > You should get the following exception in 9:10 attempts: > Exception in thread "sshd-shell[855da06]-thread-1" > java.lang.NullPointerException > at > org.apache.sshd.server.shell.ProcessShellFactory$ProcessShell.exitValue(ProcessShellFactory.java:170) > at > org.apache.sshd.server.shell.InvertedShellWrapper.pumpStreams(InvertedShellWrapper.java:165) > at > org.apache.sshd.server.shell.InvertedShellWrapper$1.run(InvertedShellWrapper.java:125) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > at java.lang.Thread.run(Thread.java:745) > I cannot understand how process can be null in this context. -- This message was sent by Atlassian JIRA (v6.3.4#6332)