Scanner/System.in Bad Behavior on Laptop

Bug #675759 reported by Charles Lourtie
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcj-4.4 (Ubuntu)
New
Undecided
Unassigned

Bug Description

The results produced by Scanner on a desktop verion of Ubuntu 10.0 differ from those produced on a laptop version. The laptop version produces results which render the program quirky to use.

This sample program demonstrates the difference in behavior:

import java.util.Scanner;
public class BadScanner
       {
      public static void main(String args[])
                    {
                     System.out.println("About to create Scanner");
                     Scanner in = new Scanner(System.in);
   System.out.println("Created Scanner, type something...");
   String str = in.nextLine();
   System.out.println("You typed: " + str + " ...now type something else");
   str = in.nextLine();
   System.out.println("And then you typed: " + str);
      }
 }

*************************************************************************************************

Desktop environment is:

Ubuntu 10.04 LTS - the Lucid Lynx

chuck@Linux-desktop:~/pierce/cs552/test$ javac -version
javac 1.6.0_18

chuck@Linux-desktop:~/pierce/cs552/test$ java -version
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.2) (6b18-1.8.2-4ubuntu2)
OpenJDK Client VM (build 16.0-b13, mixed mode, sharing)

Results of running program on desktop are exactly as expected.

chuck@Linux-desktop:~/pierce/cs552/test$ java BadScanner
About to create Scanner
Created Scanner, type something...
Hello
You typed: Hello ...now type something else
World
And then you typed: World
chuck@Linux-desktop:~/pierce/cs552/test$

*************************************************************************************************

Results of running program on laptop are NOT as expected. This is from execution of the class file created on the desktop. (Note also that according to Update Manager laptop system is up to date.)

chuck@chuck-laptop:~/pierce/cs552/test$ java BadScanner
About to create Scanner
Hello
Created Scanner, type something...
World
You typed: Hello ...now type something else
Goodbye
And then you typed: World
chuck@chuck-laptop:~/pierce/cs552/test$

Laptop environment is:

Ubuntu 10.04 LTS - the Lucid Lynx

chuck@chuck-laptop:~/pierce/cs552/test$ javac -version
gcj-4.4 (Ubuntu 4.4.3-1ubuntu2) 4.4.3
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

chuck@chuck-laptop:~/pierce/cs552/test$ java -version
java version "1.5.0"
gij (GNU libgcj) version 4.4.3

Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

*************************************************************************************************

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: gcj-4.4-jre-headless 4.4.3-1ubuntu2
ProcVersionSignature: Ubuntu 2.6.32-25.45-generic 2.6.32.21+drm33.7
Uname: Linux 2.6.32-25-generic i686
NonfreeKernelModules: nvidia
Architecture: i386
Date: Mon Nov 15 13:25:05 2010
ExecutablePath: /usr/bin/gij-4.4
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release i386 (20091028.5)
ProcEnviron:
 SHELL=/bin/bash
 LANG=en_US.utf8
SourcePackage: gcj-4.4

Revision history for this message
Charles Lourtie (lourtie) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.