DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33618>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33618

           Summary: telnet fails with java.lang.NullPointerException
           Product: Ant
           Version: 1.6.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: Optional Tasks
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


When I try to call telnet task with a property name-value pair defined on the 
command line, a NullPointerException is thrown. There are two cases:
1. a normal telnet session to a host --> it works fine

    <target name="demo_telnet" description="Telnet Demo">
        <telnet server="${host_address}"
            userid="${telnet_host_user}"
            password="${telnet_host_password}"
            timeout="30">
            <read string="${telnet_prompt}"/>
            <write string="exit"/>
        </telnet>
    </target>

This is the result:

C:\Idea\Practice\src\ant\bug-telnet>ant demo_telnet -
Dhost_address="192.168.100.119"
Buildfile: build.xml

demo_telnet:
   [telnet] Welcome to Microsoft Telnet Service
   [telnet]
   [telnet]
   [telnet] login:
   [telnet] galati\nicub
   [telnet]  galati\nicub
   [telnet]
   [telnet] password:
   [telnet]  ===============================================================
Welcome to Microsoft Telnet Server.
===============================================================
C:\Documents and Settings\nicub>
   [telnet] exit

BUILD SUCCESSFUL
Total time: 18 seconds

2. a telnet session to a http server --> it fails

    <target name="demo_http" description="Http Demo">
        <telnet server="${host_address}"
            port="80"
            timeout="20">
            <read/>
            <write string="GET /infochiosc/admin/tree/create_index.jsp 
HTTP/1.1"/>
            <write string="Host: ${host}"/>
            <write/>
            <read string="&lt;/html&gt;"/>
        </telnet>
    </target>

This is the result:

C:\Idea\Practice\src\ant\bug-telnet>ant -v demo_http -Dhost="192.168.100.119"
Apache Ant version 1.6.2 compiled on July 16 2004
Buildfile: build.xml
Detected Java version: 1.4 in: C:\j2sdk1.4.2_04\jre
Detected OS: Windows XP
parsing buildfile C:\Idea\Practice\src\ant\bug-telnet\build.xml with URI = 
file:///C:/Idea/Practice/src/ant/bug-telnet/b
uild.xml
Project base dir set to: C:\Idea\Practice\src\ant\bug-telnet
 [property] Loading C:\Idea\Practice\src\ant\bug-telnet\broadcast.properties
Build sequence for target `demo_http' is [demo_http]
Complete build sequence is [demo_http, demo_telnet, ]

demo_http:
Property ${host_address} has not been set

BUILD FAILED
C:\Idea\Practice\src\ant\bug-telnet\build.xml:8: java.lang.NullPointerException
        at org.apache.tools.ant.Task.perform(Task.java:373)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
        at org.apache.tools.ant.Main.runBuild(Main.java:673)
        at org.apache.tools.ant.Main.startAnt(Main.java:188)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
Caused by: java.lang.NullPointerException
        at org.apache.commons.net.telnet.TelnetClient.disconnect
(TelnetClient.java:125)
        at org.apache.tools.ant.taskdefs.optional.net.TelnetTask.execute
(TelnetTask.java:119)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        ... 8 more
--- Nested Exception ---
java.lang.NullPointerException
        at org.apache.commons.net.telnet.TelnetClient.disconnect
(TelnetClient.java:125)
        at org.apache.tools.ant.taskdefs.optional.net.TelnetTask.execute
(TelnetTask.java:119)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
        at org.apache.tools.ant.Main.runBuild(Main.java:673)
        at org.apache.tools.ant.Main.startAnt(Main.java:188)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)

Total time: 2 seconds

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to