Коллеги, посмотрите, пожалуйста!
Все работает как надо, но валидатор не принимает!
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) {
try {
new Solution().joinData();
} catch (CorruptedDataException e) {
System.out.println("Поймал");
}
}
public void joinData() throws CorruptedDataException {
try {BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String first = reader.readLine();
String second = reader.readLine();
reader.close();
BufferedReader freader = new BufferedReader(new InputStreamReader(new FileInputStream(first)));
String str;
while ((str = freader.readLine()) != null) {
allLines.add(str);
}
freader.close();
BufferedReader sreader = new BufferedReader(new InputStreamReader(new FileInputStream(second)));
String st;
while ((st = sreader.readLine()) != null) {
forRemoveLines.add(st);
}
sreader.close();
if (allLines.containsAll(forRemoveLines)) {
allLines.removeAll(forRemoveLines);
}
else
allLines.clear();
throw new CorruptedDataException();
}catch (IOException е) {
throw new CorruptedDataException();
}
}
}