... при тесте, вроде норм
package com.javarush.task.task19.task1921;
import java.io.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/*
Хуан Хуанович
*/
public class Solution {
public static final List<Person> PEOPLE = new ArrayList<Person>();
public static void main(String[] args) {
String fileName = args[0];
try (BufferedReader fileReader = new BufferedReader(new FileReader(fileName))) {
Pattern namePattern = Pattern.compile("\\p{Alpha}.+\\p{Alpha}", Pattern.UNICODE_CHARACTER_CLASS);
Pattern datePattern = Pattern.compile("\\d.+\\d");
Matcher matcher;
SimpleDateFormat formatter = new SimpleDateFormat("dd M yyyy");
while (fileReader.ready()) {
String line = fileReader.readLine();
matcher = namePattern.matcher(line);
while (matcher.find()) {
String name = matcher.group().trim();
//System.out.println(name);
//System.out.println(matcher);
matcher.usePattern(datePattern);
while (matcher.find()) {
//System.out.println(matcher);
String date = matcher.group();
//System.out.println(date);
try {
Date birthday = formatter.parse(date);
//System.out.println(formatter.format(birthday));
PEOPLE.add(new Person(name, birthday));
} catch (ParseException exception) {
exception.printStackTrace();
}
}
}
}
} catch (IOException exception) {
exception.printStackTrace();
}
for (Person perc : PEOPLE) {
System.out.println(perc.getName() + " " + perc.getBirthDate().toString());
}
}
}