User account creation filtered due to spam.

Bug 40630

Summary: java.util.Scanner fails when used for charset generation by the OpenJDK build
Product: classpath Reporter: Andrew John Hughes <gnu_andrew>
Component: classpathAssignee: Andrew John Hughes <gnu_andrew>
Severity: normal CC: bug-classpath
Priority: P3    
Version: 0.98   
Target Milestone: 0.99   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2009-07-07 09:22:49
Bug Depends on:    
Bug Blocks: 39410    

Description Andrew John Hughes 2009-07-03 10:44:32 UTC
/mnt/builder/icedtea/bootstrap/jdk1.6.0/bin/java -XX:-PrintVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-LogVMOutput -Xmx896m -Xms128m -XX:PermSize=32m -XX:MaxPermSize=160m -jar /mnt/builder/icedtea/openjdk-ecj/build/linux-amd64/btjars/charsetmapping.jar ../../tools/CharsetMapping /mnt/builder/icedtea/generated/sun/nio/cs/ext dbcs
Exception in thread "main" java.lang.NullPointerException
   at java.util.regex.Matcher.toMatchResult(
   at java.util.Scanner.myCoreNext(
   at java.util.Scanner.myPrepareForNext(
   at java.util.Scanner.myNextLine(
   at java.util.Scanner.hasNextLine(
Comment 1 Andrew John Hughes 2009-07-07 09:22:49 UTC
Tracked this down to a failure in java.util.Scanner.  The NPE in MatchResult is masking the real problem (the NPE itself is easily solved by only cloning match if it is non-null).
The method hasNextLine returns false if it receives a null return value, but myCoreNext never returns null. Instead, it keeps hitting the end of the input and returning an empty string.
Comment 2 Andrew John Hughes 2009-07-07 11:00:19 UTC
CVSROOT:        /sources/classpath
Module name:    classpath
Changes by:     Andrew John Hughes <gnu_andrew> 09/07/07 10:27:19

Modified files:
       .              : ChangeLog
       java/util      :

Log message:
       Correctly spot EOF in java.util.Scanner#hasNextLine().

       2009-07-07  Andrew John Hughes  <>

               PR classpath/40630
               * java/util/
               (myCoreNext(boolean, Pattern)): Set tmp2 to
               null if the string is empty (i.e. we are at
               the end of the file).
               * java/util/regex/
               (toMatchResult()): Check that match is non-null
               before attempting to clone it.

Comment 3 Andrew John Hughes 2010-10-12 17:33:06 UTC
Merged to gcj in libgcj-snapshot-20100921.