Use Eclipse (2021-06, 4.20.0) run-config settings in "Common" tab to attach a csv file to standard input. Attach a CSV parser to standard input.
Pulling CSV records from the parser gets all the file content, but doesn't detect EOF. This happens with both opencsv-5.5.2, and apache-csv-1.9.0 (and with my company's legacy csv parser).
E.g. with opencsv:
var isr = new InputStreamReader(System.in);
var br = new BufferedReader(isr);
var reader = new CSVReader(isr /* or br */);
while ( (csv_record = reader.readNext()) != null) {
// foo
}
hangs in FileInputStream.readBytes after reading all the csv lines. Call stack:
Thread [main] (Suspended)
owns: BufferedInputStream (id=75)
owns: InputStreamReader (id=22)
FileInputStream.readBytes(byte[], int, int) line: not available [native method]
FileInputStream.read(byte[], int, int) line: 279
BufferedInputStream.read1(byte[], int, int) line: 290
BufferedInputStream.read(byte[], int, int) line: 351
StreamDecoder.readBytes() line: 284
StreamDecoder.implRead(char[], int, int) line: 326
StreamDecoder.read(char[], int, int) line: 178
InputStreamReader.read(char[], int, int) line: 185
BufferedReader.fill() line: 161
BufferedReader.read() line: 182
CSVReader.isClosed() line: 399
CSVReader.getNextLine() line: 343
CSVReader.primeNextRecord() line: 235
CSVReader.flexibleRead(boolean, boolean) line: 598
CSVReader.readNext() line: 204
Main.main(String[]) line: 48
All csv parsers hang in FileInputStream.readBytes, with similar stack traces.
All variants run fine outside eclipse, using redirection.
Is this a known Eclipse bug? I searched but found nothing.
Is there any known work-around?
Hat-tip to greg-449, this is almost certainly an eclipse bug: