Что не так?
package com.javarush.task.task17.task1721;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/*
Транзакционность
*/
public class Solution {
public static List<String> allLines = new ArrayList<String>();
public static List<String> forRemoveLines = new ArrayList<String>();
public static void main(String[] args) throws CorruptedDataException{
Solution solution = new Solution();
solution.joinData();
}
public void joinData() throws CorruptedDataException {
BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));
String name1;
String name2;
String line;
try {
name1 = rd.readLine();
name2 = rd.readLine();
FileInputStream fis1 = new FileInputStream(name1);
rd = new BufferedReader(new InputStreamReader(fis1));
while ((line = rd.readLine()) != null) {
allLines.add(line);
}
FileInputStream fis2 = new FileInputStream(name2);
rd = new BufferedReader(new InputStreamReader(fis2));
while ((line = rd.readLine()) != null) {
forRemoveLines.add(line);
}
} catch (IOException e) {
e.printStackTrace();
}
if (allLines.containsAll(forRemoveLines)) {
allLines.removeAll(forRemoveLines);
} else {
allLines.clear();
throw new CorruptedDataException();
}
}
}