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

Guillaume Nodet resolved SSHD-426.
----------------------------------
       Resolution: Fixed
    Fix Version/s: 1.0.0
         Assignee: Guillaume Nodet

https://git-wip-us.apache.org/repos/asf?p=mina-sshd.git;a=commitdiff;h=91a721e945c961b3c02e940805ba1a0f0d696fb6

> Fix SftpTest#testOpen code to take into account Windows behavior
> ----------------------------------------------------------------
>
>                 Key: SSHD-426
>                 URL: https://issues.apache.org/jira/browse/SSHD-426
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Goldstein Lyor
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: 1.0.0
>
>         Attachments: 
> 0029-SSHD-426-Fix-SftpTest-testOpen-code-to-take-into-acc.patch
>
>
> The problem with the truncate option lies in the new Java 7 code for 
> _FileHandle_ constructor:
> {code:java}
> channel = FileChannel.open(file, options, attributes);
> {code}
> When the _SftpClient#open_ code passes only the _Truncate_ option, this is 
> translated to a _Set_ of options that contains only the 
> _StandardOpenOption.TRUNCATE_EXISTING_ value. According to the 
> [_FileChannel#open_ 
> Javadoc|http://docs.oracle.com/javase/7/docs/api/java/nio/channels/FileChannel.html#open(java.nio.file.Path,%20java.util.Set,%20java.nio.file.attribute.FileAttribute...)]:
> {panel}
> If neither READ / WRITE option (or the APPEND option) is contained in the 
> array then the file is opened for reading.
> {panel}
> Therefore, in our case, on _Windows_ an attempt will be made to open the file 
> for READ (and TRUNCATE, but that's besides the point). Since in _Windows_ 
> this always succeeds (files are always readable), the test fails the _"Empty 
> truncate should have failed"_ assertion.



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

Reply via email to