commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <>
Subject [jira] Resolved: (NET-319) Problem with private OutputStream __storeFileStream(int command, String remote) in
Date Thu, 08 Apr 2010 13:25:36 GMT


Sebb resolved NET-319.

    Resolution: Not A Problem

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

> Problem with  private OutputStream __storeFileStream(int command, String remote) in
> ------------------------------------------------------------------------------------------------------------------------
>                 Key: NET-319
>                 URL:
>             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 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

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

View raw message