[Commons Launcher] - Read a line from System.in is blocking

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Commons Launcher] - Read a line from System.in is blocking

Kherzi Samir
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: [Commons Launcher] - Read a line from System.in is blocking

Arnaud Héritier
Ca c'est pro ;-)

A++

-------------------------------
Arnaud HERITIER
-------------------------------
Private      : [hidden email]
Opensource   : [hidden email]
Professional : [hidden email]
-------------------------------
 

> -----Message d'origine-----
> De : Kherzi Samir [mailto:[hidden email]]
> Envoyé : mercredi 15 juin 2005 17:41
> À : [hidden email]
> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: [Commons Launcher] - Read a line from System.in is blocking

Arnaud Héritier
Sorry for this private comment ....
A bad reply-all ...


Arnaud

>
> Ca c'est pro ;-)
>
> A++
>
> -------------------------------
> Arnaud HERITIER
> -------------------------------
> Private      : [hidden email]
> Opensource   : [hidden email]
> Professional : [hidden email]
> -------------------------------
>  
>
> > -----Message d'origine-----
> > De : Kherzi Samir [mailto:[hidden email]] Envoyé :
> mercredi 15 juin
> > 2005 17:41 À : [hidden email] 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: [hidden email]
> > For additional commands, e-mail:
> [hidden email]
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Commons Launcher] - Read a line from System.in is blocking

Kherzi Samir
In reply to this post by Kherzi Samir
Any solution ?


-----Message d'origine-----
De : Kherzi Samir
Envoyé : mercredi 15 juin 2005 17:41
À : '[hidden email]'
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: [hidden email]
For additional commands, e-mail: [hidden email]