не могу понять в чем ошибка программы
package com.javarush.task.task18.task1823;
import java.io.*;
import java.util.*;
/*
Нити и байты
*/
public class Solution {
public static Map<String, Integer> resultMap = new HashMap<String, Integer>();
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while (true){
String fileName = br.readLine();
if (fileName.equals("exit")) break;
new ReadThread(fileName).start();
}
br.close();
for (Map.Entry<String, Integer> element : resultMap.entrySet()){
System.out.printf("%s %d%n", element.getKey(), element.getValue());
}
}
public static class ReadThread extends Thread {
String fileName;
FileInputStream fileInputStream;
public ReadThread(String fileName) throws Exception {
this.fileName = fileName;
this.fileInputStream = new FileInputStream(fileName);//implement constructor body
}
@Override
public synchronized void run() {
ArrayList<Integer> list = new ArrayList<>();
try {
while (fileInputStream.available() > 0) {
list.add((int) fileInputStream.read());
}
fileInputStream.close();
}catch (IOException e){}
int max = 0;
int count = 0;
for (int i : list) {
for (int k : list){
if (i == k) count++;
}
if (max < count) max = count;
count = 0;
}
synchronized (resultMap) {
resultMap.put(fileName, max);
}
}
// implement file reading here - реализуйте чтение из файла тут
}
}