[ 
https://issues.apache.org/jira/browse/SSHD-530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Goldstein Lyor resolved SSHD-530.
---------------------------------
    Resolution: Fixed

This also helped detect (and fix) a subtle bug. The previous code looked like 
this:
{code:java}
protected void doSomething(int id, Buffer buffer) throws IOException {
    try {
       ...calculate the response...
       send(...response...);
    } catch(IOException e) {
        sendStatus(id, e);
    }
}
{code}
The problem was that _send_ might throw an _IOException_ as well, in which case 
_sendStatus_ of the _catch_ clause is invoked. Usually it will most likely fail 
as well with an _IOException_, but not necessarily. The new code has the 
following template:
{code:java}
protected void doSomething(int id, Buffer buffer) throws IOException {
    try {
       ...calculate the response...
    } catch(IOException | RuntimeException e) {
        sendStatus(id, e);
        return;
    }

    send(....response...)
}
{code}
This way, any _IOException/RuntimeException_ occurring during the response 
calculation phase are sent as a status, whereas an _IOException_ occurring 
during the response sending is propagated (as it should be)

> Separate buffer decoding from processing in SFTP subsytem implementation
> ------------------------------------------------------------------------
>
>                 Key: SSHD-530
>                 URL: https://issues.apache.org/jira/browse/SSHD-530
>             Project: MINA SSHD
>          Issue Type: Improvement
>    Affects Versions: 1.0.0
>            Reporter: Goldstein Lyor
>            Assignee: Goldstein Lyor
>             Fix For: 1.0.0
>
>
> Facilitate easier extension of the implementation as well as first step 
> towards implementing an _SftpEventListener_



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to