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 /plugins/reception-plugins/src | |
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>
Diffstat (limited to 'plugins/reception-plugins/src')
9 files changed, 33 insertions, 30 deletions
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); } } |