Changed encoding to utf-8

This commit is contained in:
2022-01-29 10:06:28 +01:00
parent 4e07b01b6a
commit 780ecbee0f
14 changed files with 135 additions and 95 deletions

View File

@@ -2,6 +2,10 @@ plugins {
java
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
dependencies {
val jacksonVersion = "2.13.0"
implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion")

View File

@@ -1,19 +1,11 @@
package res;
import com.sun.jdi.event.StepEvent;
import java.io.Serializable;
import java.nio.charset.StandardCharsets;
import java.sql.SQLOutput;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
public class Event {
@@ -44,15 +36,15 @@ public class Event {
System.out.println("Create Event");
if (name.length() < 3) {
throw new IllegalArgumentException("Der Name muss eine L\u00e4nge von 3 haben.");
throw new IllegalArgumentException("Der Name muss eine Länge von 3 haben.");
}
Pattern pattern = Pattern.compile("[A-Za-z\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc\u00df0-9 =!?+*/$.:,;_<>()-]*");
Pattern pattern = Pattern.compile("[A-Za-zäöüÄÖÜß0-9 =!?+*/$.:,;_<>()-]*");
Matcher matcher = pattern.matcher(name);
if (!matcher.matches()) {
throw new IllegalArgumentException("Der Name darf nur aus Zahlen, Buchstaben und folgenden Sonderzeichen bestehen: \u00e4\u00f6\u00fc \u00c4\u00d6\u00dc \u00df =!?+*/$.:,;_ <>()-");
throw new IllegalArgumentException("Der Name darf nur aus Zahlen, Buchstaben und folgenden Sonderzeichen bestehen: äöü ÄÖÜ ß =!?+*/$.:,;_ <>()-");
}
if (priority < 0) {
throw new IllegalArgumentException("Bitte eine Priorit\u00e4t w\u00e4hlen.");
throw new IllegalArgumentException("Bitte eine Priorität wählen.");
}
LocalDateTime today = LocalDateTime.now().toLocalDate().atStartOfDay();
if (Duration.between(today, date).isNegative()) {
@@ -82,9 +74,7 @@ public class Event {
}
public void setName(String name) {
System.out.println(name);
this.name = name;
System.out.println(this.name);
}
public int getPriority() {