Skip to content
Snippets Groups Projects
Commit 1202ffc9 authored by Martin Stähr's avatar Martin Stähr
Browse files

refactor: removing useless if statements

parent c48a8071
No related branches found
No related tags found
No related merge requests found
...@@ -31,12 +31,10 @@ public class CommunicationView { ...@@ -31,12 +31,10 @@ public class CommunicationView {
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("/info/{roomId}") @Path("/info/{roomId}")
public Response getChatRoomInformation(@PathParam("roomId") String roomId) { public Response getChatRoomInformation(@PathParam("roomId") String roomId) {
if (isNull(roomId)) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
CommunicationDummyService communicationDummyService = new CommunicationDummyService(); CommunicationDummyService communicationDummyService = new CommunicationDummyService();
ChatRoom chatRoom = communicationDummyService.getChatRoomInfo(roomId); ChatRoom chatRoom = communicationDummyService.getChatRoomInfo(roomId);
if (isNull(chatRoom)) { if (isNull(chatRoom)) {
log.error("chatRoom not found for roomId: {}", roomId);
return Response.status(Response.Status.NOT_FOUND).build(); return Response.status(Response.Status.NOT_FOUND).build();
} }
log.debug("getChatRoomInformationResponse: {}", chatRoom); log.debug("getChatRoomInformationResponse: {}", chatRoom);
...@@ -47,9 +45,6 @@ public class CommunicationView { ...@@ -47,9 +45,6 @@ public class CommunicationView {
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("/history/{roomId}") @Path("/history/{roomId}")
public Response getChatHistory(@PathParam("roomId") String roomId) { public Response getChatHistory(@PathParam("roomId") String roomId) {
if (isNull(roomId)) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
CommunicationDummyService communicationDummyService = new CommunicationDummyService(); CommunicationDummyService communicationDummyService = new CommunicationDummyService();
List<ChatMessage> chatMessages = communicationDummyService.getChatHistory(roomId); List<ChatMessage> chatMessages = communicationDummyService.getChatHistory(roomId);
if (isNull(chatMessages)) { if (isNull(chatMessages)) {
...@@ -66,7 +61,7 @@ public class CommunicationView { ...@@ -66,7 +61,7 @@ public class CommunicationView {
@Path("/create") @Path("/create")
public Response createChatRoom(@QueryParam("name") String name, List<User> users) { public Response createChatRoom(@QueryParam("name") String name, List<User> users) {
if (isNull(name)) { if (isNull(name)) {
return Response.status(Response.Status.BAD_REQUEST).build(); return Response.status(Response.Status.BAD_REQUEST).entity("no name is not allowed").build();
} }
CommunicationDummyService communicationDummyService = new CommunicationDummyService(); CommunicationDummyService communicationDummyService = new CommunicationDummyService();
String chatId = communicationDummyService.createChatRoom(name, users); String chatId = communicationDummyService.createChatRoom(name, users);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment