I can't recognize, that any stream isn't closing before exit the program.
package de.codegym.task.task18.task1824;
/*
Dateien und Ausnahmen
*/
import java.io.*;
public class Solution {
public static void main(String[] args) {
FileInputStream fis = null;
BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
try {
while (true) {
String fileName = buf.readLine();
try {
fis = new FileInputStream(fileName);
} catch (FileNotFoundException fnfe) {
throw new FileNotFoundException(fileName);
}
}
} catch (IOException ioex) {
System.out.println(ioex.getMessage());
} finally {
try {
if (buf != null) {
buf.close();
}
if (fis != null) {
fis.close();
}
} catch (IOException e) {
}
}
}
}