From 871c3809529d388cc608b39fe18503eb515c7836 Mon Sep 17 00:00:00 2001 From: Yannik Bretschneider Date: Sat, 5 Jun 2021 16:47:05 +0200 Subject: [PATCH] fix: fixed non-empty String validation to be non-empty --- .../marvelous/gamelibrary/messages/ErrorMessage.java | 1 + .../gamelibrary/messages/client/HelloServerMessage.java | 5 +++-- .../gamelibrary/messages/server/GoodbyeClientMessage.java | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/ErrorMessage.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/ErrorMessage.java index ad51b9d..589e555 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/ErrorMessage.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/ErrorMessage.java @@ -1,5 +1,6 @@ package uulm.teamname.marvelous.gamelibrary.messages; +import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; public class ErrorMessage extends BasicMessage{ diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/HelloServerMessage.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/HelloServerMessage.java index 6d43244..ed9c5fc 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/HelloServerMessage.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/client/HelloServerMessage.java @@ -1,5 +1,6 @@ package uulm.teamname.marvelous.gamelibrary.messages.client; +import jakarta.validation.constraints.NotEmpty; import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage; import uulm.teamname.marvelous.gamelibrary.messages.MessageType; @@ -10,10 +11,10 @@ public class HelloServerMessage extends BasicMessage { public final MessageType messageType = MessageType.HELLO_SERVER; /** User-chosen name, basically a PlayerName */ - @NotNull + @NotEmpty public String name; /** Device ID sent by the Client, might be anything, but used together with name to uniquely identify the client */ - @NotNull + @NotEmpty public String deviceID; } diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GoodbyeClientMessage.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GoodbyeClientMessage.java index 9aee70a..b8bf4a7 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GoodbyeClientMessage.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GoodbyeClientMessage.java @@ -1,5 +1,6 @@ package uulm.teamname.marvelous.gamelibrary.messages.server; +import jakarta.validation.constraints.NotEmpty; import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage; import uulm.teamname.marvelous.gamelibrary.messages.MessageType; @@ -10,6 +11,6 @@ public class GoodbyeClientMessage extends BasicMessage { public final MessageType messageType = MessageType.GOODBYE_CLIENT; /** A message sent to the client on disconnect */ - @NotNull + @NotEmpty public String message = "You got disconnected."; }