Bug 52854

Summary: Strange entering behaviour in apache-ant 1.8.4 when we type a parameter from console
Product: Ant Reporter: Scheiber Erno <scheiber>
Component: Core tasksAssignee: Ant Notifications List <notifications>
Status: NEW ---    
Severity: minor    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Scheiber Erno 2012-03-08 07:19:03 UTC
Reading / introducing a parameter from console has a strange behaviour: 
the pressed characters (keys) do not appear on the monitor. They are 
visible only after the Enter key is pressed. In apache-ant 1.8.1 it 
was O.K., while in apache-ant 1.8.2 it does not work.

(I use Windows 7 (64), jdk1.7.0_03)

Test example
===================================================
package hello;
import java.util.Scanner;

public class HelloWorld{
  public static void main(String[] args){
    Scanner scanner=new Scanner(System.in);
    System.out.println("Enter your name");
    String name=scanner.next();
    String response=sayHello(name);
    System.out.println(response);
  }

  private static String sayHello(String name){
    return "Hello "+name+" !";
  }  
}
===================================================

<project name="hello" default="Run" basedir=".">
  <property name="build.dir" location="build"/>
  <property name="src" location="src" />

  <path id="myclasspath">
    <pathelement path="${build.dir}" /> 
  </path>  
  
  <target name="init">
    <delete dir="${build.dir}"/>
    <mkdir dir="${build.dir}"/>
  </target>

  <target name="Compile" depends="init" >
    <javac srcdir="${src}" destdir="${build.dir}" 
      includeantruntime="false" classpathref="myclasspath"/>
  </target>

  <target name="Run" depends="Compile"> 
    <java classname="hello.HelloWorld" classpathref="myclasspath" fork="true"/>
  </target>
</project>
===================================================
Comment 1 fsauceda 2012-09-28 00:59:17 UTC
I'm on Mac OS X and tried it with ant 1.8.2. I had a similar problem, after pressing the enter key nothing happens, absolutely nothing, didn't have that problem with ant 1.8.4 though