Scanner.hasNextLine() throws unexpected NPE

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

Bug Description

A simple code that use java.util.Scanner over a constant String throws a Null Pointer Exception from "hasNextLine()" after the last line has been produced. The same code works flawlessly (as expected) with Sun JVM.

> /usr/lib/jvm/java-1.5.0-gcj-4.4/bin/java bugreport
Content-Type: audio/mpeg
icy-br:128
icy-metaint:8192
Exception in thread "main" java.lang.NullPointerException
   at java.util.regex.Matcher.toMatchResult(libgcj.so.10)
   at java.util.Scanner.myCoreNext(libgcj.so.10)
   at java.util.Scanner.myPrepareForNext(libgcj.so.10)
   at java.util.Scanner.myNextLine(libgcj.so.10)
   at java.util.Scanner.hasNextLine(libgcj.so.10)
   at bugreport.main(bugreport.java:11)

If that's of any matter (given this machine is an LTS-to-LTS upgrade),
73a62bb13b3bd328a161b0faa1434676 /usr/lib/libgcj.so.10

See minimal code reproducing the bug below.

Revision history for this message
pype (pype-1999-geo) wrote :
Revision history for this message
pype (pype-1999-geo) wrote :

Code compiled with javac 1.6.0_17, if that's of any matter.
generated (and buggy) .class file attached

e7467076ce3d188c2a18e72818647ff2 bugreport.class

If "compile-with-1.6.x, run with 1.5.x" is the reason of the failure, I'd have expected the JVM to raise a warning about a java version mismatch at load-time, rather than throwing arbitrary NPE from the bowels of the lib.

HTH, may the Source be with you.

Revision history for this message
pype (pype-1999-geo) wrote :

<sigh>

Looks like ubuntu has grown so large that it's totally unable to deal with bug reports.

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.