As someone with no prior involvement with this component, and at risk of being hit by the digital tomatoes of the group, this seems to indicate to me that once a parser definition has been joined to a source of input, the resulting object *is* the record iterator. If there's no way to twist that into a comfortable API, I would tend to agree with Benedikt: calling #iterator() a second time should do something like triggering an IllegalStateException().
$0.02, Matt On Mon, Aug 12, 2013 at 4:43 PM, Gary Gregory <garydgreg...@gmail.com>wrote: > On Mon, Aug 12, 2013 at 3:26 PM, Benedikt Ritter <brit...@apache.org> > wrote: > > > Hi, > > > > I've added a new test to CSVParser test case that shows what happens if > > CSVParser.iterator() is called twice [1]. > > > > This looks pretty strange to me. One iterator can eat up records of the > > other. > > Would it be better to throw an exception if iterator() is called more > than > > once? > > > > Yeah, there is something odd about the current impl. Wouldn't it be obvious > what can be done if there is an iterator ivar and the accessor just returns > it? It does not even have to be lazy initialized. > > Gary > > > > > > Benedikt > > > > [1] http://svn.apache.org/r1513228 > > > > > > -- > > http://people.apache.org/~britter/ > > http://www.systemoutprintln.de/ > > http://twitter.com/BenediktRitter > > http://github.com/britter > > > > > > -- > E-Mail: garydgreg...@gmail.com | ggreg...@apache.org > Java Persistence with Hibernate, Second Edition< > http://www.manning.com/bauer3/> > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> > Spring Batch in Action <http://www.manning.com/templier/> > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory >