]> git.basschouten.com Git - openhab-addons.git/commitdiff
fix s3 thing status (#14925)
authorgoopilot <40123561+goopilot@users.noreply.github.com>
Wed, 3 May 2023 06:10:46 +0000 (01:10 -0500)
committerGitHub <noreply@github.com>
Wed, 3 May 2023 06:10:46 +0000 (08:10 +0200)
Signed-off-by: Alexandr Salamatov <goopilot@gmail.com>
bundles/org.openhab.binding.folderwatcher/src/main/java/org/openhab/binding/folderwatcher/internal/api/S3Actions.java
bundles/org.openhab.binding.folderwatcher/src/main/java/org/openhab/binding/folderwatcher/internal/handler/S3BucketWatcherHandler.java

index c005092e6af5ad2acd0e321e0bcfeafb9554626a..131ac7f798e82d251e102ce687ab60e71d38d50a 100644 (file)
@@ -115,7 +115,7 @@ public class S3Actions {
         List<String> returnList = new ArrayList<>();
 
         if (nameNodesList.getLength() == 0) {
-            throw new Exception("No files deceted in the bucket");
+            return returnList;
         }
 
         for (int i = 0; i < nameNodesList.getLength(); i++) {
index f7e71484775d9e83d4265939ddcb4450330547c8..9d89786bbb45b1137d9a295c91b7d3315730d5a4 100644 (file)
@@ -89,7 +89,6 @@ public class S3BucketWatcherHandler extends BaseThingHandler {
 
         if (refreshS3BucketInformation()) {
             if (config.pollIntervalS3 > 0) {
-                updateStatus(ThingStatus.ONLINE);
                 executionJob = scheduler.scheduleWithFixedDelay(this::refreshS3BucketInformation, config.pollIntervalS3,
                         config.pollIntervalS3, TimeUnit.SECONDS);
             } else {
@@ -104,6 +103,7 @@ public class S3BucketWatcherHandler extends BaseThingHandler {
         List<String> currentS3Listing = new ArrayList<>();
         try {
             currentS3Listing = s3.listBucket(config.s3Path);
+            updateStatus(ThingStatus.ONLINE);
             List<String> difS3Listing = new ArrayList<>(currentS3Listing);
             difS3Listing.removeAll(previousS3Listing);
             difS3Listing.forEach(file -> triggerChannel(CHANNEL_NEWFILE, file));