Ругается валидатор на метод joinData, в упор не вижу ошибки.
Помогите, пожалуйста.
Спасибо)
package com.javarush.task.task17.task1721;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/*
Транзакционность
*/
public class Solution {
Solution solution = new Solution();
public static List<String> allLines = new ArrayList<String>();
public static List<String> forRemoveLines = new ArrayList<String>();
public static String firstFileName;
public static String secondFileName;
public static void main(String[] args) throws InterruptedException{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
try {
firstFileName = reader.readLine();
secondFileName = reader.readLine();
reader.close();
}
catch (IOException e) {
}
ReadFile(firstFileName, allLines);
ReadFile(secondFileName, forRemoveLines);
try {
new Solution().joinData();
} catch (CorruptedDataException e) {
System.out.println("Битые данные!");
}
}
public synchronized static void ReadFile(String fileName, List list) throws InterruptedException {
ReadFileInterface f = new ReadFileThread();
f.setFileName(fileName);
f.setListName(list);
f.getFileContent(list);
f.start();
f.join();
}
public interface ReadFileInterface{
void setFileName(String fullFileName);
void setListName(List list);
void getFileContent(List list);
void join() throws InterruptedException;
void start();
}
public static class ReadFileThread extends Thread implements ReadFileInterface {
String fullFileName;
String str;
String t = "";
List<String> list = new ArrayList<>();
@Override
public void setFileName(String fullFileName) {
this.fullFileName = fullFileName;
}
@Override
public void setListName(List list) {
this.list = list;
}
@Override
public void getFileContent(List list) {
this.list = list;
}
@Override
public void run() {
try {
FileInputStream fis = new FileInputStream(fullFileName);
BufferedReader bf = new BufferedReader(new InputStreamReader(fis));
while ((str = bf.readLine()) != null) {
// str = str + " ";
list.add(str);
}
bf.close();
fis.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public void joinData() throws CorruptedDataException {
if (allLines.containsAll(forRemoveLines)){
allLines.removeAll(forRemoveLines);
}
else {
allLines.clear();
throw new CorruptedDataException();
}
}
}