Browse Source

Added exception handling for registerUser Method

remotes/origin/fdai7780
Tobias Herbert 11 months ago
parent
commit
8dd3285cbb
  1. 19
      src/main/java/org/example/Administration.java

19
src/main/java/org/example/Administration.java

@ -185,8 +185,23 @@ public class Administration {
}
else if(findProfessorById(UserId) == null || findAdminById(UserId) == null || findStudentById(UserId) == null)
{
System.out.println("The Id has not been used already!");
correctData = true;
String substring = UserId.substring(1);
if(!rightPrefix(UserId, userType))
{
correctData = false;
}
else if(!isNumber(substring))
{
System.out.println("Every character besides the first one need to be digits");
correctData = false;
}
else{
System.out.println("The Id has not been used already!");
correctData = true;
}
}
switch (userType)

Loading…
Cancel
Save