From f2ec8187e40f192478d6319ab2e8c62516dc909c Mon Sep 17 00:00:00 2001 From: j-dimension Date: Thu, 14 Sep 2023 17:04:17 +0200 Subject: [PATCH] sonarqube fixes. issue #2018 --- .../java/org/jlawyer/io/rest/v7/CasesEndpointV7.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v7/CasesEndpointV7.java b/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v7/CasesEndpointV7.java index 7cb25488e..5a2fbabcc 100644 --- a/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v7/CasesEndpointV7.java +++ b/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v7/CasesEndpointV7.java @@ -786,12 +786,11 @@ public Response getCaseMessages(@PathParam("id") String id) { try { InitialContext ic = new InitialContext(); - ArchiveFileServiceLocal cases = (ArchiveFileServiceLocal) ic.lookup("java:global/j-lawyer-server/j-lawyer-server-ejb/ArchiveFileService!com.jdimension.jlawyer.services.ArchiveFileServiceLocal"); + ArchiveFileServiceLocal cases = (ArchiveFileServiceLocal) ic.lookup(LOOKUP_CASES); ArchiveFileBean currentCase = cases.getArchiveFile(id); if (currentCase == null) { log.error("case with id " + id + " does not exist"); - Response res = Response.serverError().build(); - return res; + return Response.serverError().build(); } MessagingServiceLocal msgService = (MessagingServiceLocal) ic.lookup("java:global/j-lawyer-server/j-lawyer-server-ejb/MessagingService!com.jdimension.jlawyer.services.MessagingServiceLocal"); @@ -803,12 +802,10 @@ public Response getCaseMessages(@PathParam("id") String id) { msgList.add(m); } - Response res = Response.ok(msgList).build(); - return res; + return Response.ok(msgList).build(); } catch (Exception ex) { log.error("can not get message for case " + id, ex); - Response res = Response.serverError().build(); - return res; + return Response.serverError().build(); } }