не понимаю, где же она-ошибка
package com.javarush.task.task17.task1711;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/*
CRUD 2
*/
public class Solution {
public static volatile List<Person> allPeople = new ArrayList<Person>();
static {
allPeople.add(Person.createMale("Иванов Иван", new Date())); //сегодня родился id=0
allPeople.add(Person.createMale("Петров Петр", new Date())); //сегодня родился id=1
}
public static void main(String[] args) throws ParseException, IllegalStateException {
SimpleDateFormat simpleDateFormatIn = new SimpleDateFormat("dd-MM-yyyy", Locale.ENGLISH);
SimpleDateFormat simpleDateFormatOut = new SimpleDateFormat("dd-MMM-yyyy", Locale.ENGLISH);
Person person = null;
switch (args[0]) {
case "-c":
synchronized (allPeople) {
for (int i = 1; i < args.length; i++) {
if (args[i].equals("м")) {
person = Person.createMale(args[i - 1], simpleDateFormatIn.parse(args[i + 1]));
allPeople.add(person);
System.out.println(allPeople.indexOf(person));
} else if (args[i].equals("ж")) {
person = Person.createFemale(args[i - 1], simpleDateFormatIn.parse(args[i + 1]));
allPeople.add(person);
System.out.println(allPeople.indexOf(person));
}
}
}
break;
case "-u":
synchronized (allPeople) {
for (int i = 1; i < args.length; i = +4) {
allPeople.get(Integer.parseInt(args[i])).setName(args[i + 1]);
if (args[i + 2].equals("м")) {
allPeople.get(Integer.parseInt(args[i])).setSex(Sex.MALE);
} else if (args[i + 2].equals("ж")) {
allPeople.get(Integer.parseInt(args[i])).setSex(Sex.FEMALE);
}
allPeople.get(Integer.parseInt(args[i])).setBirthDate(simpleDateFormatIn.parse(args[i + 3]));
}
}
break;
case "-d":
synchronized (allPeople) {
for (int i = 1; i < args.length; i++) {
person = allPeople.get(Integer.parseInt(args[i]));
person.setName(null);
person.setSex(null);
person.setBirthDate(null);
}
}break;
case "-i":
synchronized (allPeople){
for (int i = 1; i < args.length; i++) {
allPeople.get(Integer.parseInt(args[i]));
System.out.println(allPeople.get(Integer.parseInt(args[i])).getName() + " " + (allPeople.get(Integer.parseInt(args[i])).getSex().equals(Sex.MALE) ? " м " : " ж ") + " " + simpleDateFormatOut.format(allPeople.get(Integer.parseInt((args[i]))).getBirthDate()));
}
}break;
}
}
}