From 7e4682614a07ff5f467e120e9d95d526cee13bc4 Mon Sep 17 00:00:00 2001 From: Sairam Vudatha Date: Thu, 3 Oct 2019 13:50:19 -0500 Subject: [PATCH] Fix PMD violations fixes, fixes issue #122 --- .../ObjectMapperClientFeatureModule.java | 1 - .../configuration/XmlConfigurationSource.java | 1 - .../cerner/beadledom/health/HealthModule.java | 3 +-- .../cerner/beadledom/jackson/JacksonModule.java | 17 ++++++----------- .../com/cerner/beadledom/jaxrs/JaxRsModule.java | 1 - .../pagination/OffsetPaginationLinks.java | 2 +- pom.xml | 3 +-- .../beadledom/swagger/SwaggerUiResource.java | 3 --- 8 files changed, 9 insertions(+), 22 deletions(-) diff --git a/client/beadledom-client-jackson/src/main/java/com/cerner/beadledom/client/jackson/ObjectMapperClientFeatureModule.java b/client/beadledom-client-jackson/src/main/java/com/cerner/beadledom/client/jackson/ObjectMapperClientFeatureModule.java index 6ff7761c..67fe43fd 100644 --- a/client/beadledom-client-jackson/src/main/java/com/cerner/beadledom/client/jackson/ObjectMapperClientFeatureModule.java +++ b/client/beadledom-client-jackson/src/main/java/com/cerner/beadledom/client/jackson/ObjectMapperClientFeatureModule.java @@ -3,7 +3,6 @@ import com.cerner.beadledom.guice.BindingAnnotations; import com.cerner.beadledom.jackson.JacksonModule; -import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; import com.google.inject.AbstractModule; import java.lang.annotation.Annotation; diff --git a/configuration/src/main/java/com/cerner/beadledom/configuration/XmlConfigurationSource.java b/configuration/src/main/java/com/cerner/beadledom/configuration/XmlConfigurationSource.java index a8e87bdc..7ed3302d 100644 --- a/configuration/src/main/java/com/cerner/beadledom/configuration/XmlConfigurationSource.java +++ b/configuration/src/main/java/com/cerner/beadledom/configuration/XmlConfigurationSource.java @@ -2,7 +2,6 @@ import java.io.IOException; import java.io.Reader; -import java.util.Properties; import org.apache.commons.configuration2.Configuration; import org.apache.commons.configuration2.FileBasedConfiguration; import org.apache.commons.configuration2.XMLConfiguration; diff --git a/health/service/src/main/java/com/cerner/beadledom/health/HealthModule.java b/health/service/src/main/java/com/cerner/beadledom/health/HealthModule.java index b163aba5..6c39c756 100644 --- a/health/service/src/main/java/com/cerner/beadledom/health/HealthModule.java +++ b/health/service/src/main/java/com/cerner/beadledom/health/HealthModule.java @@ -110,8 +110,7 @@ protected void configure() { //This is to provide a default binding for HealthDependency, // so that services with no HealthDependency bindings can start - Multibinder healthDependencyModuleBinder = Multibinder.newSetBinder(binder(), - HealthDependency.class); + Multibinder.newSetBinder(binder(), HealthDependency.class); Multibinder jacksonModuleBinder = Multibinder.newSetBinder(binder(), Module.class); jacksonModuleBinder.addBinding().to(Jdk8Module.class); diff --git a/jackson/src/main/java/com/cerner/beadledom/jackson/JacksonModule.java b/jackson/src/main/java/com/cerner/beadledom/jackson/JacksonModule.java index 01d31f4c..4495a56a 100644 --- a/jackson/src/main/java/com/cerner/beadledom/jackson/JacksonModule.java +++ b/jackson/src/main/java/com/cerner/beadledom/jackson/JacksonModule.java @@ -42,18 +42,13 @@ public class JacksonModule extends AbstractModule { protected void configure() { // Empty multibindings for dependencies - Multibinder jacksonModuleBinder = Multibinder.newSetBinder(binder(), Module.class); + Multibinder.newSetBinder(binder(), Module.class); - Multibinder serializationFeatureBinder = Multibinder - .newSetBinder(binder(), SerializationFeatureFlag.class); - Multibinder deserializationFeatureBinder = Multibinder - .newSetBinder(binder(), DeserializationFeatureFlag.class); - Multibinder jsonGeneratorFeatureBinder = Multibinder - .newSetBinder(binder(), JsonGeneratorFeatureFlag.class); - Multibinder jsonParserFeatureBinder = Multibinder - .newSetBinder(binder(), JsonParserFeatureFlag.class); - Multibinder mapperFeatureBinder = Multibinder - .newSetBinder(binder(), MapperFeatureFlag.class); + Multibinder.newSetBinder(binder(), SerializationFeatureFlag.class); + Multibinder.newSetBinder(binder(), DeserializationFeatureFlag.class); + Multibinder.newSetBinder(binder(), JsonGeneratorFeatureFlag.class); + Multibinder.newSetBinder(binder(), JsonParserFeatureFlag.class); + Multibinder.newSetBinder(binder(), MapperFeatureFlag.class); /** * MultibindingsScanner will scan all modules for methods with the annotations @ProvidesIntoMap, diff --git a/jaxrs/src/main/java/com/cerner/beadledom/jaxrs/JaxRsModule.java b/jaxrs/src/main/java/com/cerner/beadledom/jaxrs/JaxRsModule.java index 651e5d65..a5c19930 100644 --- a/jaxrs/src/main/java/com/cerner/beadledom/jaxrs/JaxRsModule.java +++ b/jaxrs/src/main/java/com/cerner/beadledom/jaxrs/JaxRsModule.java @@ -1,7 +1,6 @@ package com.cerner.beadledom.jaxrs; import com.cerner.beadledom.jaxrs.provider.CorrelationIdFilter; -import com.cerner.beadledom.jaxrs.provider.ForwardedHeaderFilter; import com.google.inject.AbstractModule; import javax.inject.Singleton; diff --git a/pagination/src/main/java/com/cerner/beadledom/pagination/OffsetPaginationLinks.java b/pagination/src/main/java/com/cerner/beadledom/pagination/OffsetPaginationLinks.java index 1584abc8..a298bf4c 100644 --- a/pagination/src/main/java/com/cerner/beadledom/pagination/OffsetPaginationLinks.java +++ b/pagination/src/main/java/com/cerner/beadledom/pagination/OffsetPaginationLinks.java @@ -120,7 +120,7 @@ private boolean hasNext() { return false; } - boolean moreResults = totalResults != null && (currentOffset + currentLimit < totalResults); + boolean moreResults = totalResults != null && currentOffset + currentLimit < totalResults; if (totalResults == null) { return hasMore != null && hasMore; diff --git a/pom.xml b/pom.xml index 3e81d7a4..b81e4fd6 100644 --- a/pom.xml +++ b/pom.xml @@ -784,8 +784,7 @@ maven-pmd-plugin ${java.version} - - false + true diff --git a/swagger1/src/main/java/com/cerner/beadledom/swagger/SwaggerUiResource.java b/swagger1/src/main/java/com/cerner/beadledom/swagger/SwaggerUiResource.java index e9244fa4..73911a33 100644 --- a/swagger1/src/main/java/com/cerner/beadledom/swagger/SwaggerUiResource.java +++ b/swagger1/src/main/java/com/cerner/beadledom/swagger/SwaggerUiResource.java @@ -7,16 +7,13 @@ import com.google.common.collect.ImmutableSet; import java.io.InputStream; import java.util.Set; -import java.util.regex.Pattern; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.StreamingOutput; import javax.ws.rs.core.UriInfo;