diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2018-11-09 08:02:39 -0500 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2018-11-09 08:02:47 -0500 |
commit | 789f09f2430440d6be44a5fad26715d002aff757 (patch) | |
tree | 1186f6fbc359102ceb641982e0f820eb8ef6bafd | |
parent | c1647ba56080a79d149b2e9fd647bda4da39997e (diff) |
Fix sonar/checkstyle issues
The main pom.xml was incorrect, so these issues have
creeped into the source code.
Issue-ID: POLICY-1256
Change-Id: Ic0b52f3a28f869252120991b0c1946ef8402bcc5
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
18 files changed, 56 insertions, 53 deletions
diff --git a/forwarding/src/main/java/org/onap/policy/distribution/forwarding/PolicyForwarder.java b/forwarding/src/main/java/org/onap/policy/distribution/forwarding/PolicyForwarder.java index 5bd53804..311bbcf7 100644 --- a/forwarding/src/main/java/org/onap/policy/distribution/forwarding/PolicyForwarder.java +++ b/forwarding/src/main/java/org/onap/policy/distribution/forwarding/PolicyForwarder.java @@ -25,8 +25,8 @@ import org.onap.policy.distribution.model.Policy; /** * Forwards polices. - * <p> - * To create a policy forwarder a class implementing this interface must be created, along with a + * + * <p>To create a policy forwarder a class implementing this interface must be created, along with a * concrete sub class of PolicyForwarderConfigurationParameterGroup to handle configuration * parameters for the policy forwarder. */ @@ -34,8 +34,8 @@ public interface PolicyForwarder { /** * Configure the policy forwarder. - * <p> - * This method will be invoked immediately after instantiation in order for the policy forwarder + * + * <p>This method will be invoked immediately after instantiation in order for the policy forwarder * to configure itself. * * @param parameterGroupName the name of the parameter group which contains the configuration diff --git a/forwarding/src/main/java/org/onap/policy/distribution/forwarding/parameters/PolicyForwarderParameters.java b/forwarding/src/main/java/org/onap/policy/distribution/forwarding/parameters/PolicyForwarderParameters.java index 2426cccd..1334b3dd 100644 --- a/forwarding/src/main/java/org/onap/policy/distribution/forwarding/parameters/PolicyForwarderParameters.java +++ b/forwarding/src/main/java/org/onap/policy/distribution/forwarding/parameters/PolicyForwarderParameters.java @@ -81,7 +81,7 @@ public class PolicyForwarderParameters implements ParameterGroup { } /** - * {@inheritDoc} + * {@inheritDoc}. */ @Override public String getName() { @@ -89,7 +89,7 @@ public class PolicyForwarderParameters implements ParameterGroup { } /** - * {@inheritDoc} + * {@inheritDoc}. */ @Override public void setName(final String name) { @@ -97,7 +97,7 @@ public class PolicyForwarderParameters implements ParameterGroup { } /** - * {@inheritDoc} + * {@inheritDoc}. */ @Override public GroupValidationResult validate() { diff --git a/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java b/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java index 4bcd1a32..c7fbbd84 100644 --- a/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java +++ b/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java @@ -200,16 +200,16 @@ public class DistributionParameterGroup implements ParameterGroup { } private void validateForwarderConfigurations(final GroupValidationResult validationResult) { - for (final Entry<String, PolicyForwarderConfigurationParameterGroup> configurationParameters : policyForwarderConfigurationParameters - .entrySet()) { + for (final Entry<String, PolicyForwarderConfigurationParameterGroup> configurationParameters : + policyForwarderConfigurationParameters.entrySet()) { validationResult.setResult("policyForwarderConfigurationParameters", configurationParameters.getKey(), configurationParameters.getValue().validate()); } } private void validateDecoderConfigurations(final GroupValidationResult validationResult) { - for (final Entry<String, PolicyDecoderConfigurationParameterGroup> configurationParameters : policyDecoderConfigurationParameters - .entrySet()) { + for (final Entry<String, PolicyDecoderConfigurationParameterGroup> configurationParameters : + policyDecoderConfigurationParameters.entrySet()) { validationResult.setResult("policyDecoderConfigurationParameters", configurationParameters.getKey(), configurationParameters.getValue().validate()); } diff --git a/main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyForwarderConfigurationParameterGroup.java b/main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyForwarderConfigurationParameterGroup.java index f2c496d4..d071afb4 100644 --- a/main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyForwarderConfigurationParameterGroup.java +++ b/main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyForwarderConfigurationParameterGroup.java @@ -25,7 +25,7 @@ import org.onap.policy.distribution.forwarding.PolicyForwarder; /** * Base class of all {@link ParameterGroup} classes for configuration parameters for - * {@link PolicyForwarder} classes + * {@link PolicyForwarder} classes. */ public abstract class PolicyForwarderConfigurationParameterGroup implements ParameterGroup { diff --git a/main/src/main/java/org/onap/policy/distribution/main/rest/DistributionRestServer.java b/main/src/main/java/org/onap/policy/distribution/main/rest/DistributionRestServer.java index fa786bda..4e2c8428 100644 --- a/main/src/main/java/org/onap/policy/distribution/main/rest/DistributionRestServer.java +++ b/main/src/main/java/org/onap/policy/distribution/main/rest/DistributionRestServer.java @@ -55,7 +55,7 @@ public class DistributionRestServer implements Startable { } /** - * {@inheritDoc} + * {@inheritDoc}. */ @Override public boolean start() { @@ -95,7 +95,7 @@ public class DistributionRestServer implements Startable { } /** - * {@inheritDoc} + * {@inheritDoc}. */ @Override public boolean stop() { @@ -110,7 +110,7 @@ public class DistributionRestServer implements Startable { } /** - * {@inheritDoc} + * {@inheritDoc}. */ @Override public void shutdown() { @@ -118,7 +118,7 @@ public class DistributionRestServer implements Startable { } /** - * {@inheritDoc} + * {@inheritDoc}. */ @Override public boolean isAlive() { @@ -126,7 +126,7 @@ public class DistributionRestServer implements Startable { } /** - * {@inheritDoc} + * {@inheritDoc}. */ @Override public String toString() { diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/ExtractFromNode.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/ExtractFromNode.java index 02b57552..f2f27ce8 100644 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/ExtractFromNode.java +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/ExtractFromNode.java @@ -24,23 +24,21 @@ import com.google.common.collect.ImmutableMap; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; - import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; import org.onap.policy.distribution.reception.decoding.PolicyDecodingException; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; import org.onap.sdc.toscaparser.api.CapabilityAssignment; import org.onap.sdc.toscaparser.api.CapabilityAssignments; -import org.onap.sdc.toscaparser.api.elements.Metadata; import org.onap.sdc.toscaparser.api.NodeTemplate; import org.onap.sdc.toscaparser.api.RequirementAssignment; +import org.onap.sdc.toscaparser.api.elements.Metadata; /** * Extract concerned info from NodeTemplate, currently ONLY HPA Feature. diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpxConfigurationParameterGroup.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpxConfigurationParameterGroup.java index d785b827..26fd2a5a 100644 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpxConfigurationParameterGroup.java +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpxConfigurationParameterGroup.java @@ -28,7 +28,7 @@ import org.onap.policy.distribution.reception.parameters.PolicyDecoderConfigurat /** * This class handles reading, parsing and validating of the paramaters for the - * {@link PolicyDecoderCsarPdpx} + * {@link PolicyDecoderCsarPdpx}. */ public class PolicyDecoderCsarPdpxConfigurationParameterGroup extends PolicyDecoderConfigurationParameterGroup { @@ -80,7 +80,7 @@ public class PolicyDecoderCsarPdpxConfigurationParameterGroup extends PolicyDeco } /** - * {@inheritDoc} + * {@inheritDoc}. */ @Override public GroupValidationResult validate() { diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandler.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandler.java index 3434f816..9ac21550 100644 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandler.java +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandler.java @@ -22,7 +22,6 @@ package org.onap.policy.distribution.reception.handling.sdc; import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE; -import java.io.IOException; import java.io.File; import java.nio.file.FileSystems; import java.nio.file.Path; @@ -54,7 +53,7 @@ public class FileSystemReceptionHandler extends AbstractReceptionHandler { ParameterService.get(parameterGroupName); main(handlerParameters.getWatchPath()); } catch (final PolicyDecodingException ex) { - ex.printStackTrace(); + LOGGER.debug(ex); } } @@ -64,10 +63,15 @@ public class FileSystemReceptionHandler extends AbstractReceptionHandler { running = false; } + /** + * Main entry point. + * + * @param watchPath Path to watch + * @throws PolicyDecodingException Decoding exception + */ @SuppressWarnings("unchecked") public void main(String watchPath) throws PolicyDecodingException { - try { - final WatchService watcher = FileSystems.getDefault().newWatchService(); + try (final WatchService watcher = FileSystems.getDefault().newWatchService()) { final Path dir = Paths.get(watchPath); dir.register(watcher, ENTRY_CREATE); @@ -77,7 +81,8 @@ public class FileSystemReceptionHandler extends AbstractReceptionHandler { try { key = watcher.take(); } catch (final InterruptedException ex) { - ex.printStackTrace(); + LOGGER.debug(ex); + Thread.currentThread().interrupt(); return; } for (final WatchEvent<?> event : key.pollEvents()) { diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandlerConfigurationParameterGroup.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandlerConfigurationParameterGroup.java index 79f6c208..98f3c6a4 100644 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandlerConfigurationParameterGroup.java +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandlerConfigurationParameterGroup.java @@ -49,7 +49,7 @@ public class FileSystemReceptionHandlerConfigurationParameterGroup extends Recep } /** - * {@inheritDoc} + * {@inheritDoc}. */ @Override public GroupValidationResult validate() { @@ -68,8 +68,8 @@ public class FileSystemReceptionHandlerConfigurationParameterGroup extends Recep */ private void validatePathElement(final GroupValidationResult validationResult, final String element, final String elementName) { - File f = new File(element); - if (!(f.exists() && f.isDirectory())) { + File file = new File(element); + if (!(file.exists() && file.isDirectory())) { validationResult.setResult(elementName, ValidationStatus.INVALID, elementName + " must be a valid directory"); } diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterGroup.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterGroup.java index bdc9767d..6746dc35 100644 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterGroup.java +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterGroup.java @@ -141,7 +141,7 @@ public class SdcReceptionHandlerConfigurationParameterGroup extends ReceptionHan } /** - * {@inheritDoc} + * {@inheritDoc}. */ @Override public GroupValidationResult validate() { diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactDownloadException.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactDownloadException.java index 89f305fd..a021870a 100644 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactDownloadException.java +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactDownloadException.java @@ -36,8 +36,8 @@ public class ArtifactDownloadException extends Exception { * * @param message The message to dump */ - public ArtifactDownloadException (final String message) { - super (message); + public ArtifactDownloadException(final String message) { + super(message); } @@ -47,8 +47,8 @@ public class ArtifactDownloadException extends Exception { * @param message The message to dump * @param e the exception that caused this exception to be thrown */ - public ArtifactDownloadException (final String message, final Exception e) { - super (message, e); + public ArtifactDownloadException(final String message, final Exception ex) { + super(message, ex); } } diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerException.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerException.java index 043b0a41..bc60813e 100644 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerException.java +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerException.java @@ -36,8 +36,8 @@ public class ArtifactInstallerException extends Exception { * * @param message The message to dump */ - public ArtifactInstallerException (final String message) { - super (message); + public ArtifactInstallerException(final String message) { + super(message); } @@ -47,8 +47,8 @@ public class ArtifactInstallerException extends Exception { * @param message The message to dump * @param e the exception that caused this exception to be thrown */ - public ArtifactInstallerException (final String message, final Exception e) { - super (message, e); + public ArtifactInstallerException(final String message, final Exception ex) { + super(message, ex); } } diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdControllerException.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdControllerException.java index 9dece808..a2117c63 100644 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdControllerException.java +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdControllerException.java @@ -36,8 +36,8 @@ public class PssdControllerException extends Exception { * * @param message The message to dump */ - public PssdControllerException (final String message) { - super (message); + public PssdControllerException(final String message) { + super(message); } @@ -47,8 +47,8 @@ public class PssdControllerException extends Exception { * @param message The message to dump * @param e the exception that caused this exception to be thrown */ - public PssdControllerException (final String message, final Exception e) { - super (message, e); + public PssdControllerException(final String message, final Exception ex) { + super(message, ex); } } diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdParametersException.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdParametersException.java index ca17796c..26504c95 100644 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdParametersException.java +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdParametersException.java @@ -36,8 +36,8 @@ public class PssdParametersException extends Exception { * * @param message The message to dump */ - public PssdParametersException (final String message) { - super (message); + public PssdParametersException(final String message) { + super(message); } @@ -47,8 +47,8 @@ public class PssdParametersException extends Exception { * @param message The message to dump * @param e the exception that caused this exception to be thrown */ - public PssdParametersException (final String message, final Exception e) { - super (message, e); + public PssdParametersException(final String message, final Exception ex) { + super(message, ex); } } @@ -134,7 +134,7 @@ with minor changes --> <configLocation>onap-checkstyle/onap-java-style.xml</configLocation> <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory --> - <sourceDirectory>${project.build.sourceDirectory}/src/main/java</sourceDirectory> + <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory> <includeResources>true</includeResources> <includeTestSourceDirectory>true</includeTestSourceDirectory> <includeTestResources>true</includeTestResources> diff --git a/reception/src/main/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandler.java b/reception/src/main/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandler.java index 8782f795..7f3d80b5 100644 --- a/reception/src/main/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandler.java +++ b/reception/src/main/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandler.java @@ -47,7 +47,7 @@ public abstract class AbstractReceptionHandler implements ReceptionHandler { private PluginHandler pluginHandler; /** - * {@inheritDoc} + * {@inheritDoc}. */ @Override public void initialize(final String parameterGroupName) throws PluginInitializationException { diff --git a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PolicyDecoderParameters.java b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PolicyDecoderParameters.java index 91ada5ff..f56f8b64 100644 --- a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PolicyDecoderParameters.java +++ b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PolicyDecoderParameters.java @@ -81,7 +81,7 @@ public class PolicyDecoderParameters implements ParameterGroup { } /** - * {@inheritDoc} + * {@inheritDoc}. */ @Override public String getName() { @@ -89,7 +89,7 @@ public class PolicyDecoderParameters implements ParameterGroup { } /** - * {@inheritDoc} + * {@inheritDoc}. */ @Override public void setName(final String name) { @@ -97,7 +97,7 @@ public class PolicyDecoderParameters implements ParameterGroup { } /** - * {@inheritDoc} + * {@inheritDoc}. */ @Override public GroupValidationResult validate() { diff --git a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerConfigurationParameterGroup.java b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerConfigurationParameterGroup.java index c3163665..3fa877db 100644 --- a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerConfigurationParameterGroup.java +++ b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerConfigurationParameterGroup.java @@ -25,7 +25,7 @@ import org.onap.policy.distribution.reception.handling.ReceptionHandler; /** * Base class of all {@link ParameterGroup} classes for configuration parameters for - * {@link ReceptionHandler} classes + * {@link ReceptionHandler} classes. */ public abstract class ReceptionHandlerConfigurationParameterGroup implements ParameterGroup { |