Никак не пойму, что не так с файл ридером. Почему валидатор его не видит?
package com.javarush.task.task19.task1924;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
/*
Замена чисел
*/
public class Solution {
public static Map<Integer, String> map = new HashMap<Integer, String>();
static {
map.put(0, "ноль");
map.put(1, "один");
map.put(2, "два");
map.put(3, "три");
map.put(4, "четыре");
map.put(5, "пять");
map.put(6, "шесть");
map.put(7, "семь");
map.put(8, "восемь");
map.put(9, "девять");
map.put(10, "десять");
map.put(11, "одиннадцать");
map.put(12, "двенадцать");
}
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String fileName = reader.readLine();
reader.close();
reader = new BufferedReader(new FileReader(new File(fileName)));
String currentLine = "";
while ((currentLine = reader.readLine()) != null) {
String[] words = currentLine.split(" ");
for (int i = 0; i < words.length; i++) {
try {
int currentDigit = Integer.parseInt(words[i]);
if (currentDigit >= 0 && currentDigit <= 12) {
System.out.print(map.get(currentDigit));
} else {
System.out.print(words[i]);
}
} catch (NumberFormatException e) {
System.out.print(words[i]);
}
if (i != words.length - 1) {
System.out.print(" ");
}
}
System.out.println();
}
reader.close();
}
}