Could Someone explain where i am wrong and why i cannot close the filereader
package fr.codegym.task.task19.task1924;
import javax.swing.plaf.basic.BasicButtonUI;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
/*
Remplacement de nombres
*/
public class Solution {
public static Map<Integer, String> map = new HashMap<Integer, String>();
//les variables statiques sont intialisées dans des blocs statics
static {
map.put(0,"zéro") ;
map.put(1,"un");
map.put(2,"deux");
map.put(3,"trois");
map.put(4,"quatre");
map.put(5,"cinq");
map.put(6,"six");
map.put(7,"sept");
map.put(8,"huit");
map.put(9,"neuf");
map.put(10,"dix");
map.put(11,"onze");
map.put(12,"douze");
}
public static void main(String[] args) throws IOException {
// read the file name
String fileName = null;
try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
fileName = reader.readLine();
} catch (IOException ignored) {
}
FileReader fileReader = new FileReader(fileName);
BufferedReader bufferedReader = new BufferedReader(fileReader);
String s = null;
while ((s != bufferedReader.readLine())){
//We create an array with only the numbers (0,1,2, .....12)
String[] u = s.replaceAll("\\D"," ").trim().split(" ");
if(u!=null){//if array contains a number
for(String h:u){
int v = Integer.parseInt(h); // convert the number to an int
for (Map.Entry<Integer,String> p : map.entrySet()) {//search this value in the map
if(p.getKey().equals(v))
s.replaceAll(h, p.getValue());
}
}
}
System.out.println(s);
}
// close the file
}
}