commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (NET-608) Exception when using addProtocolCommandListener with library org.apache.commons.net.telnet.TelnetClient
Date Tue, 07 Feb 2017 19:35:41 GMT

    [ https://issues.apache.org/jira/browse/NET-608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15856627#comment-15856627
] 

Sebb commented on NET-608:
--------------------------

Some clients don't currently support the ProtocolCommand Listener.

I don't think it would make sense for the TelnetClient in any case, as that is not a command-response
protocol like most of the others.
TelnetClient offers registerSpyStream() etc instead.

Nor does it really make much sense for the WhoisClient as that is so simple.

> Exception when using addProtocolCommandListener with library org.apache.commons.net.telnet.TelnetClient
> -------------------------------------------------------------------------------------------------------
>
>                 Key: NET-608
>                 URL: https://issues.apache.org/jira/browse/NET-608
>             Project: Commons Net
>          Issue Type: Bug
>          Components: Telnet
>    Affects Versions: 3.5
>         Environment: Windows 7, Java JDK 1.8, 
>            Reporter: Anthony Kearns
>            Priority: Minor
>              Labels: newbie
>
> According to the API documentation for WhoisClient and FTPClient these commands appear
to support inherited functionality of addProtocolCommandListener.
> However, when i used this as follows....i get exceptions raised for TelnetClient and
WhoisClient but not the FTPClient.
> Is this a bug or as designed? Or am I missing something ?
>    import org.apache.commons.net.*;
>    import org.apache.commons.net.ProtocolCommandListener;
>    import org.apache.commons.net.ftp.FTPClient;
>    import org.apache.commons.net.telnet.TelnetClient;
>    import org.apache.commons.net.whois.WhoisClient;
>    import java.io.PrintWriter;
>    public class WhoisExample
>    {
>        public static void main(String args[])
>        {
>            try {
>                WhoisClient whoisClient = new WhoisClient();
>                whoisClient.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
>            }
>            catch(Exception e) {
>                System.out.println("whois client exception" + e);
>            }
>            try {
>                TelnetClient telnetClient = new TelnetClient();
>                telnetClient.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
>            }
>            catch(Exception e) {
>                System.out.println("telnet client exception" + e);
>            }
>            try {
>                FTPClient ftpClient = new FTPClient();
>                ftpClient.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
>                System.out.println("no ftp client exception here !");
>            }
>            catch(Exception e)
>            {
>                System.out.println("ftp client exception" + e);
>            }
>        }
>    }
> I get the following exception....
> Caught: java.lang.NullPointerException Disconnected from the target VM, address: '127.0.0.1:3140',
transport: 'socket' java.lang.NullPointerException at org.apache.commons.net.SocketClient.addProtocolCommandListener(SocketClient.java:772)
at org.apache.commons.net.SocketClient$addProtocolCommandListener.call(Unknown Source)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message