X10 reading from a file not as expected

163 views Asked by At

I encountered following behavior when reading from a text file.

val input = new File(inputFileName);
val inp = input.openRead();
Console.OUT.println(inp.lines().next());
if (inp.lines().hasNext())
     Console.OUT.println(inp.lines().next());

my input file contains

0 1
0 2
0 3

As a result I get

0 1
0 3

It seems that inp.lines().hasNext() has moved the pointer forward and as a result one line is skipped in the text file. Is this a bug?

1

There are 1 answers

1
Josh Milthorpe On BEST ANSWER

Yes, this looks like a bug. x10.io.FileReader.lines().hasNext() should not be skipping forward in the text file. Could you please raise an issue in the X10 JIRA project?