aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-05-06 16:39:17 -0400
committerJim Hahn <jrh3@att.com>2021-05-06 16:48:30 -0400
commit8cd519ee397bd6661eddfeea1b989a99d1caac2e (patch)
tree0770d461c5afd76ecf7e603885cb7f2e936c654c /plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file
parenta05cc62b6426d31c23f60dbe4a6f367331431ea4 (diff)
Fix sonars in policy-distribution
Fixed: - use "var" instead of actual type Issue-ID: POLICY-3285 Change-Id: I0dba2f96870722b4071ac0085287bc91a27dde88 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file')
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandler.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandler.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandler.java
index d405f0ad..be27657c 100644
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandler.java
+++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandler.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Intel Corp. All rights reserved.
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property.
+ * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,9 +61,9 @@ public class FileSystemReceptionHandler extends AbstractReceptionHandler {
try {
final FileSystemReceptionHandlerConfigurationParameterGroup handlerParameters =
ParameterService.get(parameterGroupName);
- final FileClientHandler fileClientHandler =
+ final var fileClientHandler =
new FileClientHandler(this, handlerParameters.getWatchPath(), handlerParameters.getMaxThread());
- final Thread fileWatcherThread = new Thread(fileClientHandler);
+ final var fileWatcherThread = new Thread(fileClientHandler);
fileWatcherThread.start();
} catch (final Exception ex) {
LOGGER.error("FileSystemReceptionHandler initialization failed", ex);
@@ -93,8 +93,8 @@ public class FileSystemReceptionHandler extends AbstractReceptionHandler {
* @param watchPath Path to watch
*/
public void initFileWatcher(final String watchPath, final int maxThread) throws IOException {
- try (final WatchService watcher = FileSystems.getDefault().newWatchService()) {
- final Path dir = Paths.get(watchPath);
+ try (final var watcher = FileSystems.getDefault().newWatchService()) {
+ final var dir = Paths.get(watchPath);
dir.register(watcher, ENTRY_CREATE);
LOGGER.debug("Watch Service registered for dir: {}", dir.getFileName());
startWatchService(watcher, dir, maxThread);
@@ -161,7 +161,7 @@ public class FileSystemReceptionHandler extends AbstractReceptionHandler {
*/
protected void createPolicyInputAndCallHandler(final String fileName) {
try {
- final Csar csarObject = new Csar(fileName);
+ final var csarObject = new Csar(fileName);
DistributionStatisticsManager.updateTotalDownloadCount();
inputReceived(csarObject);
DistributionStatisticsManager.updateDownloadSuccessCount();
@@ -174,10 +174,10 @@ public class FileSystemReceptionHandler extends AbstractReceptionHandler {
}
private void waitForFileToBeReady(final String fullFilePath) throws InterruptedException {
- boolean flag = true;
+ var flag = true;
while (flag) {
TimeUnit.MILLISECONDS.sleep(100);
- try (ZipFile zipFile = new ZipFile(fullFilePath)) {
+ try (var zipFile = new ZipFile(fullFilePath)) {
flag = false;
} catch (final IOException exp) {
LOGGER.error("file is not ready for reading, wait for sometime and try again", exp);