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

Sebb resolved NET-319.
----------------------

    Resolution: Not A Problem

The Javadocs for all the methods that call __storeFileStream clearly state that 
null may be returned.

> Problem with  private OutputStream __storeFileStream(int command, String 
> remote) in org.apache.commons.net.ftp.FTPClient
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: NET-319
>                 URL: https://issues.apache.org/jira/browse/NET-319
>             Project: Commons Net
>          Issue Type: Improvement
>         Environment: Used a standalone to connect to Mainframes z/os system, 
> later the code will be moved to unix box as part of web-project
>            Reporter: Swami Nandan
>
> private OutputStream __storeFileStream(int command, String remote)
>         throws IOException
>     {
>         Socket socket;
>         if((socket = _openDataConnection_(command, remote)) == null)
>             return null;
>         OutputStream output = socket.getOutputStream();
>         if(__fileType == 0)
>         {
>             output = new BufferedOutputStream(output, 1024);
>             output = new ToNetASCIIOutputStream(output);
>         }
>         return new SocketOutputStream(socket, output);
>     }
> This method in FTPClient.java is called by the method storeFileStream(String 
> str). At line number 6 in the above mentioned method, it returns null when 
> unable to open DataConnection which could be because of concurrent file 
> access issues. In such cases instead of returning null, this method should 
> throw an IOException like:
> Socket socket;
>         if((socket = _openDataConnection_(command, remote)) == null) throw 
> new IOException;
> As of now in my code i have used a null check to avoid this. However i could 
> not understand why an outputstream creation method will return a null 
> reference and not throw an IOException. It was hard to believe that I was 
> getting null pointer exception while getting an output stream reference.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to