diff options
22 files changed, 42 insertions, 82 deletions
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingUtils.java b/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingUtils.java index 9bfbe68d..369e77a4 100644 --- a/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingUtils.java +++ b/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingUtils.java @@ -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; } diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/MessageCodes.java b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/MessageCodes.java index ab5712ff..9116051b 100644 --- a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/MessageCodes.java +++ b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/MessageCodes.java @@ -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. */ diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/PolicyLogger.java b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/PolicyLogger.java index c582ea85..870e63aa 100644 --- a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/PolicyLogger.java +++ b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/PolicyLogger.java @@ -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; } diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java index fd680451..1fe560d8 100644 --- a/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java +++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java @@ -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); } } diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestBeanValidationResult.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestBeanValidationResult.java index 8f978c69..8795602a 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestBeanValidationResult.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestBeanValidationResult.java @@ -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()); diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java index 7276b504..bd2cf101 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java @@ -109,8 +109,7 @@ public class TestParametersL10 extends ParameterGroupImpl { public void triggerValidationStatus(final ValidationStatus triggerStatus, int level) { if (level == 0) { return; - } - else { + } else { level--; } diff --git a/gson/src/test/java/org/onap/policy/common/gson/DoubleConverterTest.java b/gson/src/test/java/org/onap/policy/common/gson/DoubleConverterTest.java index c81a5cd6..f4e3a76b 100644 --- a/gson/src/test/java/org/onap/policy/common/gson/DoubleConverterTest.java +++ b/gson/src/test/java/org/onap/policy/common/gson/DoubleConverterTest.java @@ -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); diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java index 28e8e387..ff4d2976 100644 --- a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java +++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java @@ -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 diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java index 33c51e21..62103925 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java @@ -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 diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java index 65ebf2d2..feca72f9 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java @@ -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; } diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java index 469794c7..c2b590a0 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java @@ -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( diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/utils/DmaapPropertyUtils.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/utils/DmaapPropertyUtils.java index 7e0d3ff6..5cb220b2 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/utils/DmaapPropertyUtils.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/utils/DmaapPropertyUtils.java @@ -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); diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/utils/PropertyUtils.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/utils/PropertyUtils.java index 265346c9..7f15502e 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/utils/PropertyUtils.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/utils/PropertyUtils.java @@ -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); } } diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java index 2ff1d56b..601c3e9f 100644 --- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java +++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java @@ -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); @@ -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. @@ -122,42 +122,6 @@ </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> diff --git a/utils/src/main/java/org/onap/policy/common/utils/resources/TextFileUtils.java b/utils/src/main/java/org/onap/policy/common/utils/resources/TextFileUtils.java index c5b8c981..2810c7be 100644 --- a/utils/src/main/java/org/onap/policy/common/utils/resources/TextFileUtils.java +++ b/utils/src/main/java/org/onap/policy/common/utils/resources/TextFileUtils.java @@ -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(); } } diff --git a/utils/src/main/java/org/onap/policy/common/utils/services/FeatureApiUtils.java b/utils/src/main/java/org/onap/policy/common/utils/services/FeatureApiUtils.java index e88361ea..332e0f67 100644 --- a/utils/src/main/java/org/onap/policy/common/utils/services/FeatureApiUtils.java +++ b/utils/src/main/java/org/onap/policy/common/utils/services/FeatureApiUtils.java @@ -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 { diff --git a/utils/src/main/java/org/onap/policy/common/utils/services/OrderedServiceImpl.java b/utils/src/main/java/org/onap/policy/common/utils/services/OrderedServiceImpl.java index 7c5c9cbb..998d6742 100644 --- a/utils/src/main/java/org/onap/policy/common/utils/services/OrderedServiceImpl.java +++ b/utils/src/main/java/org/onap/policy/common/utils/services/OrderedServiceImpl.java @@ -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 diff --git a/utils/src/main/java/org/onap/policy/common/utils/validation/Version.java b/utils/src/main/java/org/onap/policy/common/utils/validation/Version.java index efbf9378..527113dd 100644 --- a/utils/src/main/java/org/onap/policy/common/utils/validation/Version.java +++ b/utils/src/main/java/org/onap/policy/common/utils/validation/Version.java @@ -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; diff --git a/utils/src/test/java/org/onap/policy/common/utils/properties/PropertyObjectUtilsTest.java b/utils/src/test/java/org/onap/policy/common/utils/properties/PropertyObjectUtilsTest.java index 83b264f5..93b30643 100644 --- a/utils/src/test/java/org/onap/policy/common/utils/properties/PropertyObjectUtilsTest.java +++ b/utils/src/test/java/org/onap/policy/common/utils/properties/PropertyObjectUtilsTest.java @@ -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( diff --git a/utils/src/test/java/org/onap/policy/common/utils/properties/exception/PropertyAccessExceptionTest.java b/utils/src/test/java/org/onap/policy/common/utils/properties/exception/PropertyAccessExceptionTest.java index 27b0e850..ef2051d8 100644 --- a/utils/src/test/java/org/onap/policy/common/utils/properties/exception/PropertyAccessExceptionTest.java +++ b/utils/src/test/java/org/onap/policy/common/utils/properties/exception/PropertyAccessExceptionTest.java @@ -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)); } /** diff --git a/utils/src/test/java/org/onap/policy/common/utils/services/FeatureApiUtilsTest.java b/utils/src/test/java/org/onap/policy/common/utils/services/FeatureApiUtilsTest.java index 232d3409..d111962e 100644 --- a/utils/src/test/java/org/onap/policy/common/utils/services/FeatureApiUtilsTest.java +++ b/utils/src/test/java/org/onap/policy/common/utils/services/FeatureApiUtilsTest.java @@ -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()); } |