From ac3c28f302fbad8af915e05a2c4d9157a15149ba Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Wed, 30 Aug 2017 05:58:36 -0700 Subject: Fix Sonar bugs In service java package Blocker issues fixed Change-Id: I5c6ff6374c40d8e24c4fa920ca2af139761b9e4a Issue-Id: CLAMP-43 Signed-off-by: Determe, Sebastien (sd378r) --- .../org/onap/clamp/clds/service/CldsService.java | 24 ++++++++++------------ .../onap/clamp/clds/service/LogServiceImpl.java | 21 +++++++++---------- 2 files changed, 21 insertions(+), 24 deletions(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java index c0f711165..3d6d54a11 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java @@ -23,6 +23,14 @@ package org.onap.clamp.clds.service; +import com.att.ajsc.common.AjscService; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; + import java.io.IOException; import java.io.InputStream; import java.sql.SQLException; @@ -52,7 +60,6 @@ import javax.xml.transform.TransformerException; import org.apache.commons.lang3.StringUtils; import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.runtime.ProcessInstance; -import org.jboss.resteasy.spi.BadRequestException; import org.onap.clamp.clds.client.DcaeDispatcherServices; import org.onap.clamp.clds.client.DcaeInventoryServices; import org.onap.clamp.clds.client.SdcCatalogServices; @@ -79,14 +86,6 @@ import org.springframework.context.ApplicationContext; import org.springframework.http.HttpStatus; import org.springframework.web.client.HttpClientErrorException; -import com.att.ajsc.common.AjscService; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; - import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -595,14 +594,13 @@ public class CldsService extends SecureServiceBase { * * @param test * @param dcaeEvent - * @throws BadRequestException */ @ApiOperation(value = "Accepts events for a model", notes = "", response = String.class) @POST @Path("/dcae/event") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - public String postDcaeEvent(@QueryParam("test") String test, DcaeEvent dcaeEvent) throws BadRequestException { + public String postDcaeEvent(@QueryParam("test") String test, DcaeEvent dcaeEvent) { Date startTime = new Date(); LoggingUtils.setRequestContext("CldsService: Post dcae event", getPrincipalName()); String userid = null; @@ -929,7 +927,7 @@ public class CldsService extends SecureServiceBase { } operationStatus = dcaeDispatcherServices.getOperationStatus(createNewDeploymentStatusUrl); } - if (operationStatus != null && operationStatus.equalsIgnoreCase("succeeded")) { + if (operationStatus.equalsIgnoreCase("succeeded")) { String artifactName = model.getControlName(); if (artifactName != null) { artifactName = artifactName + ".yml"; @@ -973,7 +971,7 @@ public class CldsService extends SecureServiceBase { } operationStatus = dcaeDispatcherServices.getOperationStatus(operationStatusUndeployUrl); } - if (operationStatus != null && operationStatus.equalsIgnoreCase("succeeded")) { + if (operationStatus.equalsIgnoreCase("succeeded")) { String artifactName = model.getControlName(); if (artifactName != null) { artifactName = artifactName + ".yml"; diff --git a/src/main/java/org/onap/clamp/clds/service/LogServiceImpl.java b/src/main/java/org/onap/clamp/clds/service/LogServiceImpl.java index f38e129be..2f02aa6ab 100644 --- a/src/main/java/org/onap/clamp/clds/service/LogServiceImpl.java +++ b/src/main/java/org/onap/clamp/clds/service/LogServiceImpl.java @@ -23,6 +23,12 @@ package org.onap.clamp.clds.service; +import com.att.ajsc.camunda.core.AttCamundaHistoryEvent; +import com.att.ajsc.camunda.core.AttCamundaService; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.gson.Gson; + import java.util.HashMap; import java.util.List; import java.util.Map; @@ -51,25 +57,19 @@ import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSenderImpl; import org.springframework.stereotype.Service; -import com.att.ajsc.camunda.core.AttCamundaHistoryEvent; -import com.att.ajsc.camunda.core.AttCamundaService; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.google.gson.Gson; - @Service public class LogServiceImpl implements LogService { - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(LogServiceImpl.class); + protected static final EELFLogger logger = EELFManager.getInstance().getLogger(LogServiceImpl.class); protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); @Autowired - private RuntimeService runtimeService; + private RuntimeService runtimeService; @Autowired - private HistoryService historyService; + private HistoryService historyService; @Context - private MessageContext context; + private MessageContext context; public void setRuntimeService(RuntimeService runtimeService) { this.runtimeService = runtimeService; @@ -165,7 +165,6 @@ public class LogServiceImpl implements LogService { if (classUrl != null) { logger.info(LogMessages.LOGSERVICE_EMAIL_CLASS, classUrl.getFile()); } else { - logger.info(LogMessages.LOGSERVICE_EMAIL_CLASS, classUrl.getFile()); logger.info(LogMessages.LOGSERVICE_EMAIL_CLASS_NULL); } email.send(); -- cgit 1.2.3-korg