Scanner/System.in Bad Behavior on Laptop
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.
String str = in.nextLine();
System.
str = in.nextLine();
System.
}
}
*******
Desktop environment is:
Ubuntu 10.04 LTS - the Lucid Lynx
chuck@Linux-
javac 1.6.0_18
chuck@Linux-
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.2) (6b18-1.
OpenJDK Client VM (build 16.0-b13, mixed mode, sharing)
Results of running program on desktop are exactly as expected.
chuck@Linux-
About to create Scanner
Created Scanner, type something...
Hello
You typed: Hello ...now type something else
World
And then you typed: World
chuck@Linux-
*******
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-
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 environment is:
Ubuntu 10.04 LTS - the Lucid Lynx
chuck@chuck-
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-
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-
ProcVersionSign
Uname: Linux 2.6.32-25-generic i686
NonfreeKernelMo
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