Any solution ?

-----Message d'origine-----
De : Kherzi Samir 
Envoyé : mercredi 15 juin 2005 17:41
À : '[email protected]'
Objet : [Commons Launcher] - Read a line from System.in is blocking


Hi,

I've notice a bug (or somthing that looks like) using Commons Launcher on Unix 
(HP-UX 11,
Sun Solaris 8, Linux) with a JRE 1.4.2. I use in my code a method that wait for 
a user
input from System.in:
----------------------------------------------------------------------
   // read a line on the console
   public static String console() throws IOException
   {
      InputStreamReader isr = new InputStreamReader(System.in);
      BufferedReader br = new BufferedReader(isr);
      String line = br.readLine();
      return line;
   }
----------------------------------------------------------------------

When I call consecutively this method many times, the prompt seems to
wait infinitly:
   String myString = null;
   System.out.print("1 - Enter something: "); myString = console();
   System.out.print("2 - Enter something: "); myString = console();
   System.out.print("3 - Enter something: "); myString = console();

To unlock the console() return call, I have to type on the << return >> 
keyboard key
many times to take my input from the command line.

This never happens when I execute my code outside a Commons Launcher script.
This never happens too on my Windows (Windows 2000, jre 1.4.2).

Please find at this URL the complete test:
 >    http://samir.kherzi.free.fr/TestCommonsLauncher.tar    <

You will find in this package the following files that will help to
reproduce the problem:
--------------------------------------------------------------------
  ant.jar                   : the ant jar
  ant-launcher.jar          : the ant launcher jar
  commons-launcher.jar      : the commons launcher jar
  xercesImpl.jar            : the xerces jar
  xml-apis.jar              : the xml api jar

  LauncherBootstrap.class   : the class from commons
  launcher.properties       : the properties to find ant jars
  launcher.xml              : the ant project

  TestCommonsLauncher.java  : the source code of console()
  TestCommonsLauncher.class : the class of console

  compile.sh                : the script to compile (unix)
  compile.bat               : the script to compile (win32)

  go.sh                     : script shell to launch classicaly the test (unix)
  go_usingCL.sh             : script shell to launch the test using Commons 
Launcher (unix)
  go.bat                    : script shell to launch classicaly the test (win32)
  go_usingCL.bat            : script shell to launch the test using Commons 
Launcher (win32)
--------------------------------------------------------------------


Best regards,
Samir KHERZI.

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

Reply via email to