You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2017/02/07 19:35:42 UTC

[jira] [Resolved] (NET-608) Exception when using addProtocolCommandListener with library org.apache.commons.net.telnet.TelnetClient

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

Sebb resolved NET-608.
----------------------
       Resolution: Not A Problem
    Fix Version/s:     (was: 3.6)

> 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)