I am getting UnmappableCharacterException on the collect() method call (or on the toList() call):
private static void handleTransaction(Path a_filePath, String a_sTrasactionName, String a_sTransactionFilePath) {
// read file into stream, try-with-resources
try (Stream<String> stream = Files.lines(Paths.get(a_filePath.toString()), Charset.defaultCharset())) {
List<String> list =
stream.filter(line -> (line.indexOf(a_sTrasactionName) > 0))
.collect(Collectors.toList());
list.forEach(line -> {
System.out.println(line);
try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(_FILES_PATH + a_sTransactionFilePath),Charset.defaultCharset(), StandardOpenOption.APPEND)) {
writer.write(line + "\n");
} catch (IOException e) {
e.printStackTrace();
}
});
} catch (IOException e1) {
e1.printStackTrace();
}
It worked for me once, but never since then.
The files I read are csv files which were created on solaris. I run the jar on Windows 2012 server
Can you advise please?
Thank you.