Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #32940

Re: java.util.Scanner hasNext returns true, next throws NoSuchElementException

Newsgroups comp.lang.java.programmer
Date 2015-10-27 09:57 -0700
References <f0815dfd-0228-4a1a-af8d-40034de9aeb1@googlegroups.com> <mv8lmj$bqg$1@dont-email.me> <6ca929bc-5bd0-4c1e-84a2-aa288a3f6973@googlegroups.com>
Message-ID <033473dd-d4cb-406a-a5cd-17873610885b@googlegroups.com> (permalink)
Subject Re: java.util.Scanner hasNext returns true, next throws NoSuchElementException
From lndresnick@gmail.com

Show all headers | View raw


On Friday, October 9, 2015 at 11:29:26 AM UTC-4, lndre...@gmail.com wrote:
> On Friday, October 9, 2015 at 11:17:44 AM UTC-4, Jeff Higgins wrote:
> > On 10/09/2015 10:12 AM, lndresnick@gmail.com wrote:
> > > Debugging an exception in my code, found out that under certain conditions java.util.Scanner hasNext() returns true, but next() throws NoSuchElementException. I submitted a bug against java to Oracle for this today, but throwing it out here so folks searching can find.
> > 
> > Just searched Oracle bugs database for Scanner. Several bugs seem to
> > describe the behavior you describe. Didn't find a bug report for a
> > Scanner dated today.
> > 
> 
> Thanks.  I submitted the bug and got an auto-reply.  Based on that auto-reply, I gather they triage submissions before adding to actual bug DB. 
> 
> I found in the Oracle defect database 3 java.util.Scanner bugs related to the internal buffer size, but not quite this one (i.e. none have the NoSuchElementException).

There is a bug now.

http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8139414

Given the other bugs going back a few years, shame this rather basic code hasn't been fixed...

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

java.util.Scanner hasNext returns true, next throws NoSuchElementException lndresnick@gmail.com - 2015-10-09 07:12 -0700
  Re: java.util.Scanner hasNext returns true, next throws NoSuchElementException Jeff Higgins <jeff@invalid.invalid> - 2015-10-09 11:16 -0400
    Re: java.util.Scanner hasNext returns true, next throws NoSuchElementException lndresnick@gmail.com - 2015-10-09 08:29 -0700
      Re: java.util.Scanner hasNext returns true, next throws NoSuchElementException lndresnick@gmail.com - 2015-10-27 09:57 -0700
  Re: java.util.Scanner hasNext returns true, next throws NoSuchElementException Jan Burse <janburse@fastmail.fm> - 2015-10-27 19:25 +0100

csiph-web