diff --git a/build.number b/build.number index e29e6bc..58e6618 100644 --- a/build.number +++ b/build.number @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Wed Nov 22 15:37:52 CET 2023 -build.number=14 +#Wed Jan 24 14:57:19 CET 2024 +build.number=15 diff --git a/source/java/src/org/lucee/extension/resource/s3/S3.java b/source/java/src/org/lucee/extension/resource/s3/S3.java index 747b457..3e63773 100755 --- a/source/java/src/org/lucee/extension/resource/s3/S3.java +++ b/source/java/src/org/lucee/extension/resource/s3/S3.java @@ -236,10 +236,10 @@ private S3(S3Cache cache, String accessKeyId, String secretAccessKey, String hos } } + this.log = getLog(config); if (cacheRegions) { - new CacheRegions().start(); + new CacheRegions(this.log).start(); } - this.log = getLog(config); } public String getHost() { @@ -327,7 +327,6 @@ private String extractExpectedRegion(String msg, AmazonServiceException ase) { } catch (S3Exception e) { if (log != null) log.error("s3", e); - else e.printStackTrace(); } } } @@ -1210,7 +1209,6 @@ public S3Info get(String bucketName, final String objectName) throws S3Exception if ("NoSuchBucket".equals(ase.getErrorCode()) || "404".equals(ase.getStatusCode())) return null; } if (log != null) log.error("s3", e); - else e.printStackTrace(); } /* Recursively delete all the objects inside given bucket */ @@ -2354,7 +2352,7 @@ public Region getBucketRegion(String bucketName, boolean loadIfNecessary) throws return null; } if (log != null) log.error("s3", "failed to load region", ase); - else ase.printStackTrace(); + // could be AccessDenied cache.bucketRegions.put(bucketName, RegionFactory.ERROR); return null; @@ -2775,6 +2773,12 @@ public String toString() { private class CacheRegions extends Thread { + private Log log; + + public CacheRegions(Log log) { + this.log = log; + } + @Override public void run() { AmazonS3Client client = null; @@ -2801,7 +2805,6 @@ public void run() { catch (S3Exception e1) { if (!"AccessDenied".equalsIgnoreCase(e1.getErrorCode())) { // in case we can not the region because of access right, we don't care. if (log != null) log.log(Log.LEVEL_DEBUG, "s3", e1); - else e1.printStackTrace(); } } catch (Exception e) {