diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Participant.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Participant.java index 844f941..cf0ccf5 100644 --- a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Participant.java +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Participant.java @@ -4,7 +4,7 @@ import java.io.Serializable; public interface Participant extends Serializable { String getName(); - void setName(String name); + void setName(String name) throws InvalidNameException; boolean equals(Participant participant); void change(Participant participant) throws Person.InvalidPhoneNumberException; } diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Player.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Player.java index 69da1a0..2637ee9 100644 --- a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Player.java +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Player.java @@ -71,9 +71,9 @@ public class Player extends Person implements Participant { */ public void setDateOfBirth(String dateOfBirth) throws InvalidDateException { logger.finer("Trying to set of birth with the String " + dateOfBirth + " provided"); - if(dateOfBirth.length() > 0) { + if (dateOfBirth.length() > 0) { String[] date = dateOfBirth.split("\\."); - try{ + try { this.dateOfBirth = LocalDate.of(Integer.valueOf(date[2]), Integer.valueOf(date[1]), Integer.valueOf(date[0])); logger.fine("Date of birth of" + getName() + " has been set to " + dateOfBirth); } catch (NumberFormatException | IndexOutOfBoundsException e) { @@ -99,7 +99,7 @@ public class Player extends Person implements Participant { /** * Override of equals method to compare participants against each other * - * @param participant + * @param participant to be compared with this instance * @return true if equals, false if not */ @Override @@ -114,7 +114,7 @@ public class Player extends Person implements Participant { * @param participant the new participant to be added */ @Override - public void change(Participant participant) { + public void change(Participant participant) throws InvalidPhoneNumberException { logger.fine("changing the current Player " + this + "with " + participant.getName()); Player player = (Player) participant; diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Tournament.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Tournament.java index 276f201..9c8c47a 100644 --- a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Tournament.java +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Tournament.java @@ -59,7 +59,7 @@ public class Tournament implements Serializable { * * @param newParticipant the Participant to be saved or edited */ - public void saveParticipant(Participant newParticipant) { + public void saveParticipant(Participant newParticipant) throws Person.InvalidPhoneNumberException { logger.fine("Trying to add " + newParticipant + " into the tournament"); for (Participant participant : participants) { if (participant.equals(newParticipant)) {