commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "sg (JIRA)" <j...@apache.org>
Subject [jira] Updated: (NET-307) One of the "connect" method in class org.apache.commons.net.SocketClient doesn't handle connection timeout properly
Date Fri, 15 Jan 2010 00:16:54 GMT

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

sg updated NET-307:
-------------------

    Description: 
org.apache.commons.net.SocketClient method connect (line 225) doesn't use the configured timeout
value.

Original code:

{code:title=SocketClient.java (line 225)|borderStyle=solid}
    public void connect(String hostname, int port,
                        InetAddress localAddr, int localPort)
    throws SocketException, IOException
    {
        _socket_ = _socketFactory_.createSocket(hostname, port, localAddr, localPort);
        _connectAction_();
    }
{code}

Working alternative:

{code:title=SocketClient.java (line 225)|borderStyle=solid}
    public void connect(String hostname, int port,
                        InetAddress localAddr, int localPort)
    throws SocketException, IOException
    {
        _socket_ = _socketFactory_.createSocket();
        _socket_.bind(new InetSocketAddress(localAddr, localPort));
        _socket_.connect(new InetSocketAddress(hostname, port), connectTimeout);
        _connectAction_();
    }
{code}

  was:
org.apache.commons.net.SocketClient method connect (line 225) doesn't use the configured timeout
value.

Original code:

{code:title=SocketClient.java (line 225)|borderStyle=solid}
    public void connect(String hostname, int port,
                        InetAddress localAddr, int localPort)
    throws SocketException, IOException
    {
        _socket_ = _socketFactory_.createSocket(hostname, port, localAddr, localPort);
        _connectAction_();
    }
{code}

Proposed working alternative:

{code:title=SocketClient.java (line 225)|borderStyle=solid}
    public void connect(String hostname, int port,
                        InetAddress localAddr, int localPort)
    throws SocketException, IOException
    {
        _socket_ = _socketFactory_.createSocket();
        _socket_.bind(new InetSocketAddress(localAddr, localPort));
        _socket_.connect(new InetSocketAddress(hostname, port), connectTimeout);
        _connectAction_();
    }
{code}


> One of the "connect" method in class org.apache.commons.net.SocketClient doesn't handle
connection timeout properly
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: NET-307
>                 URL: https://issues.apache.org/jira/browse/NET-307
>             Project: Commons Net
>          Issue Type: Improvement
>    Affects Versions: 2.0
>         Environment: Not applicable
>            Reporter: sg
>            Priority: Minor
>
> org.apache.commons.net.SocketClient method connect (line 225) doesn't use the configured
timeout value.
> Original code:
> {code:title=SocketClient.java (line 225)|borderStyle=solid}
>     public void connect(String hostname, int port,
>                         InetAddress localAddr, int localPort)
>     throws SocketException, IOException
>     {
>         _socket_ = _socketFactory_.createSocket(hostname, port, localAddr, localPort);
>         _connectAction_();
>     }
> {code}
> Working alternative:
> {code:title=SocketClient.java (line 225)|borderStyle=solid}
>     public void connect(String hostname, int port,
>                         InetAddress localAddr, int localPort)
>     throws SocketException, IOException
>     {
>         _socket_ = _socketFactory_.createSocket();
>         _socket_.bind(new InetSocketAddress(localAddr, localPort));
>         _socket_.connect(new InetSocketAddress(hostname, port), connectTimeout);
>         _connectAction_();
>     }
> {code}

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


Mime
View raw message