Changes for checkstyle 8.32 07/109307/1
authorliamfallon <liam.fallon@est.tech>
Thu, 18 Jun 2020 12:49:01 +0000 (13:49 +0100)
committerliamfallon <liam.fallon@est.tech>
Thu, 18 Jun 2020 13:11:15 +0000 (14:11 +0100)
Issue-ID: POLICY-2188
Change-Id: I00843c61a6567001fc35c3ebb77b6843a1eb7da2
Signed-off-by: liamfallon <liam.fallon@est.tech>
22 files changed:
common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingUtils.java
common-logging/src/main/java/org/onap/policy/common/logging/eelf/MessageCodes.java
common-logging/src/main/java/org/onap/policy/common/logging/eelf/PolicyLogger.java
common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java
common-parameters/src/test/java/org/onap/policy/common/parameters/TestBeanValidationResult.java
common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java
gson/src/test/java/org/onap/policy/common/gson/DoubleConverterTest.java
integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java
integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java
integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/utils/DmaapPropertyUtils.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/utils/PropertyUtils.java
policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java
pom.xml
utils/src/main/java/org/onap/policy/common/utils/resources/TextFileUtils.java
utils/src/main/java/org/onap/policy/common/utils/services/FeatureApiUtils.java
utils/src/main/java/org/onap/policy/common/utils/services/OrderedServiceImpl.java
utils/src/main/java/org/onap/policy/common/utils/validation/Version.java
utils/src/test/java/org/onap/policy/common/utils/properties/PropertyObjectUtilsTest.java
utils/src/test/java/org/onap/policy/common/utils/properties/exception/PropertyAccessExceptionTest.java
utils/src/test/java/org/onap/policy/common/utils/services/FeatureApiUtilsTest.java

index 9bfbe68..369e77a 100644 (file)
@@ -67,7 +67,7 @@ public class OnapLoggingUtils {
      * @param arguments output arguments
      * @return
      */
-    public static String formatMessage(String format, Object ...arguments) {
+    public static String formatMessage(String format, Object...arguments) {
         if (arguments.length <= 0 || arguments[0] == null) {
             return format;
         }
index ab5712f..9116051 100644 (file)
@@ -149,7 +149,7 @@ public enum MessageCodes implements EELFResolvableErrorEnum {
     MESSAGE_ERROR_SAMPLE;
 
 
-    /**
+    /*
      * Static initializer to ensure the resource bundles for this class are loaded... Here this
      * application loads messages from three bundles.
      */
index c582ea8..870e63a 100644 (file)
@@ -486,7 +486,7 @@ public class PolicyLogger {
             return;
         }
         if (arguments.length == 1 && OnapLoggingUtils.isThrowable(arguments[0])) {
-            String arguments2 = getNormalizedStackTrace((Throwable)arguments[0], "");
+            String arguments2 = getNormalizedStackTrace((Throwable) arguments[0], "");
             debugLogger.info(MessageCodes.GENERAL_INFO, message + arguments2);
             return;
         }
@@ -571,7 +571,7 @@ public class PolicyLogger {
             return;
         }
         if (arguments.length == 1 && OnapLoggingUtils.isThrowable(arguments[0])) {
-            String arguments2 = getNormalizedStackTrace((Throwable)arguments[0], "");
+            String arguments2 = getNormalizedStackTrace((Throwable) arguments[0], "");
             debugLogger.warn(MessageCodes.GENERAL_INFO, message + arguments2);
             return;
         }
@@ -661,7 +661,7 @@ public class PolicyLogger {
             return;
         }
         if (arguments.length == 1 && OnapLoggingUtils.isThrowable(arguments[0])) {
-            String arguments2 = getNormalizedStackTrace((Throwable)arguments[0], "");
+            String arguments2 = getNormalizedStackTrace((Throwable) arguments[0], "");
             errorLogger.error(MessageCodes.GENERAL_ERROR, message + arguments2);
             return;
         }
@@ -747,7 +747,7 @@ public class PolicyLogger {
             return;
         }
         if (arguments.length == 1 && OnapLoggingUtils.isThrowable(arguments[0])) {
-            String arguments2 = getNormalizedStackTrace((Throwable)arguments[0], "");
+            String arguments2 = getNormalizedStackTrace((Throwable) arguments[0], "");
             debugLogger.debug(MessageCodes.GENERAL_INFO, message + arguments2);
             return;
         }
@@ -1200,7 +1200,7 @@ public class PolicyLogger {
             return;
         }
         if (arguments.length == 1 && OnapLoggingUtils.isThrowable(arguments[0])) {
-            String arguments2 = getNormalizedStackTrace((Throwable)arguments[0], "");
+            String arguments2 = getNormalizedStackTrace((Throwable) arguments[0], "");
             metricsLogger.info(MessageCodes.RULE_METRICS_INFO, message + arguments2);
             return;
         }
index fd68045..1fe560d 100644 (file)
@@ -111,8 +111,7 @@ public class GroupValidationResult extends CommonGroupValidationResult {
         if (ParameterGroup.class.isAssignableFrom(fieldType)) {
             if (null != fieldObject) {
                 return ((ParameterGroup) fieldObject).validate();
-            }
-            else {
+            } else {
                 return new GroupValidationResult((ParameterGroup) fieldObject);
             }
         }
index 8f978c6..8795602 100644 (file)
@@ -160,7 +160,7 @@ public class TestBeanValidationResult {
 
     @Test
     public void testValidateMap() {
-        Map<String,ValidationResult> map = null;
+        Map<String, ValidationResult> map = null;
         bean = new BeanValidationResult(NAME, OBJECT);
         assertTrue(bean.validateMap(MY_MAP, map, validMapEntry()));
         assertTrue(bean.isValid());
index 7276b50..bd2cf10 100644 (file)
@@ -109,8 +109,7 @@ public class TestParametersL10 extends ParameterGroupImpl {
     public void triggerValidationStatus(final ValidationStatus triggerStatus, int level) {
         if (level == 0) {
             return;
-        }
-        else {
+        } else {
             level--;
         }
 
index c81a5cd..f4e3a76 100644 (file)
@@ -59,7 +59,7 @@ public class DoubleConverterTest {
         assertEquals("[list, null, 21]", list.toString());
 
         // map
-        Map<String,Object> map = new LinkedHashMap<>();
+        Map<String, Object> map = new LinkedHashMap<>();
         map.put("map-A", "map-value");
         map.put("map-B", null);
         map.put("map-C", 22.0);
@@ -88,13 +88,13 @@ public class DoubleConverterTest {
     @Test
     public void testConvertFromDoubleMap() {
         // null is ok
-        DoubleConverter.convertFromDouble((Map<String,Object>) null);
+        DoubleConverter.convertFromDouble((Map<String, Object>) null);
 
-        Map<String,Object> map = new LinkedHashMap<>();
+        Map<String, Object> map = new LinkedHashMap<>();
         map.put("keyA", "valueA");
         map.put("keyB", 200.0);
 
-        Map<String,Object> nested = new LinkedHashMap<>();
+        Map<String, Object> nested = new LinkedHashMap<>();
         map.put("keyC", nested);
         nested.put("nested-key", 201.0);
 
index 28e8e38..ff4d297 100644 (file)
@@ -332,7 +332,7 @@ public class DbDao {
      */
     public IntegrityAuditEntity getMyIntegrityAuditEntity() throws DbDaoTransactionException {
 
-        return updateIae("getMyIntegrityAuditEntity", this.resourceName, this.persistenceUnit, (em,iae) -> {
+        return updateIae("getMyIntegrityAuditEntity", this.resourceName, this.persistenceUnit, (em, iae) -> {
 
             if (iae != null) {
                 // refresh the object from DB in case cached data was returned
@@ -404,7 +404,7 @@ public class DbDao {
      */
     private void register(String altDbUrl) throws DbDaoTransactionException {
 
-        updateIae("register", this.resourceName, this.persistenceUnit, (em,iae) -> {
+        updateIae("register", this.resourceName, this.persistenceUnit, (em, iae) -> {
             IntegrityAuditEntity iae2 = iae;
 
             // If it already exists, we just want to update the properties and lastUpdated date
@@ -460,7 +460,7 @@ public class DbDao {
         logger.debug("setDesignated: enter, resourceName: " + resourceName + ", persistenceUnit: " + persistenceUnit
                 + ", designated: " + desig);
 
-        updateIae("setDesignated", resourceName, persistenceUnit, (em,iae) -> {
+        updateIae("setDesignated", resourceName, persistenceUnit, (em, iae) -> {
 
             if (iae != null) {
                 // refresh the object from DB in case cached data was returned
@@ -493,7 +493,7 @@ public class DbDao {
      * @throws DbDaoTransactionException if an error occurs
      */
     private IntegrityAuditEntity updateIae(String methodName, String resourceName, String persistenceUnit,
-                    BiConsumer<EntityManager,IntegrityAuditEntity> updater) throws DbDaoTransactionException {
+                    BiConsumer<EntityManager, IntegrityAuditEntity> updater) throws DbDaoTransactionException {
         try {
 
             EntityManager em = emf.createEntityManager();
@@ -547,7 +547,7 @@ public class DbDao {
         logger.debug("setLastUpdated: enter, resourceName: " + this.resourceName + ", persistenceUnit: "
                 + this.persistenceUnit);
 
-        updateIae("setLastUpdated", this.resourceName, this.persistenceUnit, (em,iae) -> {
+        updateIae("setLastUpdated", this.resourceName, this.persistenceUnit, (em, iae) -> {
 
             if (iae != null) {
                 // refresh the object from DB in case cached data was returned
index 33c51e2..6210392 100644 (file)
@@ -359,7 +359,7 @@ public class IntegrityMonitor {
             // create instance of StateManagement class and pass emf to it
             stateManager = new StateManagement(emf, resourceName);
 
-            /**
+            /*
              * Initialize the state and status attributes. This will maintain any Administrative state value but will
              * set the operational state = enabled, availability status = null, standby status = null. The integrity
              * monitor will set the operational state via the FPManager and the owning application must set the standby
index 65ebf2d..feca72f 100644 (file)
@@ -147,7 +147,7 @@ public class StateManagement {
      *        was updated, {@code null} if no change was made
      * @throws StateManagementException if an error occurs
      */
-    private void setState(String methodName, String resourceName, ExFunction<StateManagementEntity,String> updateState)
+    private void setState(String methodName, String resourceName, ExFunction<StateManagementEntity, String> updateState)
                     throws StateManagementException {
 
         synchronized (SYNCLOCK) {
@@ -513,7 +513,7 @@ public class StateManagement {
     }
 
     @FunctionalInterface
-    private static interface ExFunction<T,R> {
+    private static interface ExFunction<T, R> {
         public R update(T object) throws IntegrityMonitorException;
     }
 
index 469794c..c2b590a 100644 (file)
@@ -292,8 +292,8 @@ public interface BusPublisher {
          */
         public DmaapDmePublisherWrapper(BusTopicParams busTopicParams) {
 
-            super(ProtocolTypeConstants.DME2, busTopicParams.getServers(),busTopicParams.getTopic(),
-                    busTopicParams.getUserName(),busTopicParams.getPassword(),busTopicParams.isUseHttps());
+            super(ProtocolTypeConstants.DME2, busTopicParams.getServers(), busTopicParams.getTopic(),
+                    busTopicParams.getUserName(), busTopicParams.getPassword(), busTopicParams.isUseHttps());
 
             String dme2RouteOffer = busTopicParams.isAdditionalPropsValid()
                             ? busTopicParams.getAdditionalProps().get(
index 7e0d3ff..5cb220b 100644 (file)
@@ -36,10 +36,10 @@ public class DmaapPropertyUtils {
     /**
      * Maps a topic property to a DME property.
      */
-    private static final Map<String,String> PROP_TO_DME;
+    private static final Map<String, String> PROP_TO_DME;
 
     static {
-        Map<String,String> map = new HashMap<>();
+        Map<String, String> map = new HashMap<>();
 
         map.put(PolicyEndPointProperties.PROPERTY_DMAAP_DME2_ROUTE_OFFER_SUFFIX,
                         PolicyEndPointProperties.DME2_ROUTE_OFFER_PROPERTY);
index 265346c..7f15502 100644 (file)
@@ -129,7 +129,7 @@ public class PropertyUtils {
     }
 
     @FunctionalInterface
-    public static interface TriConsumer<A,B,C> {
+    public static interface TriConsumer<A, B, C> {
         public void accept(A propName, B propValue, C exception);
     }
 }
index 2ff1d56..601c3e9 100644 (file)
@@ -386,7 +386,7 @@ public class HttpServerTest {
         logger.info("-- testMultipleServers() --");
 
         HttpServletServer server1 = HttpServletServerFactoryInstance.getServerFactory()
-                        .build("echo-1", false,LOCALHOST, port, "/", true, true);
+                        .build("echo-1", false, LOCALHOST, port, "/", true, true);
         server1.addServletPackage("/*", this.getClass().getPackage().getName());
         server1.waitedStart(5000);
 
diff --git a/pom.xml b/pom.xml
index 7546db0..1b275a1 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
   ONAP policy
   ================================================================================
   Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
-  Modifications Copyright (C) 2019 Nordix Foundation.
+  Modifications Copyright (C) 2019-2020 Nordix Foundation.
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
                     </dependency>
                 </dependencies>
             </plugin>
-            <plugin>
-                <artifactId>maven-checkstyle-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>onap-java-style</id>
-                        <goals>
-                            <goal>check</goal>
-                        </goals>
-                        <phase>process-sources</phase>
-                        <configuration>
-                    <!-- Use Google Java Style Guide:
-                    https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
-                    with minor changes -->
-                            <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
-                    <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory -->
-                            <sourceDirectories>${project.build.sourceDirectory}</sourceDirectories>
-                            <includeResources>true</includeResources>
-                            <includeTestSourceDirectory>true</includeTestSourceDirectory>
-                            <includeTestResources>true</includeTestResources>
-                            <excludes>
-                            </excludes>
-                            <consoleOutput>true</consoleOutput>
-                            <failsOnViolation>true</failsOnViolation>
-                            <violationSeverity>warning</violationSeverity>
-                        </configuration>
-                    </execution>
-                </executions>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.onap.oparent</groupId>
-                        <artifactId>checkstyle</artifactId>
-                        <version>${oparent.version}</version>
-                        <scope>compile</scope>
-                    </dependency>
-                </dependencies>
-            </plugin>
         </plugins>
     </build>
     <reporting>
index c5b8c98..2810c7b 100644 (file)
@@ -108,8 +108,7 @@ public abstract class TextFileUtils {
             if (charsRead > 0) {
                 builder.append(chars, 0, charsRead);
             }
-        }
-        while (charsRead > 0);
+        } while (charsRead > 0);
         return builder.toString();
     }
 }
index e88361e..332e0f6 100644 (file)
@@ -44,7 +44,7 @@ public class FeatureApiUtils {
      *         otherwise
      */
     public static <T> boolean apply(List<T> providers, Predicate<T> predicate,
-                    BiConsumer<T,Exception> handleEx) {
+                    BiConsumer<T, Exception> handleEx) {
 
         for (T feature : providers) {
             try {
index 7c5c9cb..998d674 100644 (file)
@@ -44,7 +44,7 @@ public class OrderedServiceImpl<T extends OrderedService> {
     private ServiceLoader<T> serviceLoader = null;
 
     // use this to ensure that we only use one unique instance of each class
-    private static Map<Class<?>,OrderedService> classToSingleton = new HashMap<>();
+    private static Map<Class<?>, OrderedService> classToSingleton = new HashMap<>();
 
     /**
      * Constructor - create the 'ServiceLoader' instance.
@@ -86,7 +86,7 @@ public class OrderedServiceImpl<T extends OrderedService> {
         // build a list of all of the current implementors
         List<T> tmp = new LinkedList<>();
         for (T service : serviceLoader) {
-            tmp.add((T)getSingleton(service));
+            tmp.add((T) getSingleton(service));
         }
 
         // Sort the list according to sequence number, and then alphabetically
index efbf937..527113d 100644 (file)
@@ -62,8 +62,7 @@ public class Version implements Comparable<Version> {
             this.major = newVersion.major;
             this.minor = newVersion.minor;
             this.patch = newVersion.patch;
-        }
-        else {
+        } else {
             this.major = 0;
             this.minor = 0;
             this.patch = 0;
index 83b264f..93b3064 100644 (file)
@@ -104,7 +104,7 @@ public class PropertyObjectUtilsTest {
 
         Map<String, Object> result = PropertyObjectUtils.toObject(props, "");
         // @formatter:off
-        Map<String,Object> map =
+        Map<String, Object> map =
             Map.of("abc",
                 Arrays.asList(null, "expand.ghi", "expand.def"));
         // @formatter:on
@@ -119,7 +119,7 @@ public class PropertyObjectUtilsTest {
 
         Map<String, Object> result = PropertyObjectUtils.toObject(props, "");
         // @formatter:off
-        Map<String,Object> map =
+        Map<String, Object> map =
             Map.of("object",
                 Map.of("abc",
                     Map.of("ghi", "object.jkl")));
@@ -134,7 +134,7 @@ public class PropertyObjectUtilsTest {
 
         Map<String, Object> result = PropertyObjectUtils.toObject(props, "");
         // @formatter:off
-        Map<String,Object> map =
+        Map<String, Object> map =
             Map.of("array",
                 Map.of("abc",
                     List.of(
index 27b0e85..ef2051d 100644 (file)
@@ -34,10 +34,10 @@ public class PropertyAccessExceptionTest extends SupportBasicPropertyExceptionTe
      */
     @Test
     public void testPropertyAccessExceptionStringField() {
-        verifyPropertyExceptionStringField_AllPopulated( new PropertyAccessException(PROPERTY, FIELD));
-        verifyPropertyExceptionStringField_NullProperty( new PropertyAccessException(null, FIELD));
-        verifyPropertyExceptionStringField_NullField( new PropertyAccessException(PROPERTY, null));
-        verifyPropertyExceptionStringField_BothNull( new PropertyAccessException(null, null));
+        verifyPropertyExceptionStringField_AllPopulated(new PropertyAccessException(PROPERTY, FIELD));
+        verifyPropertyExceptionStringField_NullProperty(new PropertyAccessException(null, FIELD));
+        verifyPropertyExceptionStringField_NullField(new PropertyAccessException(PROPERTY, null));
+        verifyPropertyExceptionStringField_BothNull(new PropertyAccessException(null, null));
     }
 
     /**
index 232d340..d111962 100644 (file)
@@ -61,7 +61,7 @@ public class FeatureApiUtilsTest {
     public void testApplyFeatureFalse() {
         List<String> lst = Arrays.asList("falseF1", "exceptF2", "falseF3");
 
-        assertFalse(FeatureApiUtils.apply(lst, pred, (str,ex) -> errors.add(str)));
+        assertFalse(FeatureApiUtils.apply(lst, pred, (str, ex) -> errors.add(str)));
         assertEquals(lst.toString(), tried.toString());
         assertEquals("[exceptF2]", errors.toString());
     }