diff --git a/.checkstyle/suppressions.xml b/.checkstyle/suppressions.xml index e2bb2830..c3d6395f 100644 --- a/.checkstyle/suppressions.xml +++ b/.checkstyle/suppressions.xml @@ -26,4 +26,7 @@ + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 2dce9df3..8cd7d8e1 100644 --- a/build.gradle +++ b/build.gradle @@ -60,8 +60,6 @@ dependencies { implementation 'software.amazon.awssdk:s3-transfer-manager' implementation 'software.amazon.awssdk.crt:aws-crt:0.29.7' implementation 'org.slf4j:slf4j-api:2.0.11' - implementation 'ch.qos.logback:logback-classic:1.4.14' - implementation 'ch.qos.logback:logback-core:1.4.14' implementation 'com.github.ben-manes.caffeine:caffeine:3.1.8' examplesImplementation project diff --git a/src/examples/java/software/amazon/nio/spi/examples/ListPrefix.java b/src/examples/java/software/amazon/nio/spi/examples/ListPrefix.java index fdafea65..f733c3e4 100644 --- a/src/examples/java/software/amazon/nio/spi/examples/ListPrefix.java +++ b/src/examples/java/software/amazon/nio/spi/examples/ListPrefix.java @@ -9,16 +9,14 @@ import java.net.URI; import java.nio.file.Files; import java.nio.file.Paths; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +@SuppressWarnings("CheckStyle") public class ListPrefix { - private static final Logger logger = LoggerFactory.getLogger(ListPrefix.class); - public static void main(String[] args) throws IOException { if (args.length == 0) { - logger.error("Provide an s3 prefix to list."); + System.err.println("Provide an s3 prefix to list."); + //logger.error("Provide an s3 prefix to list."); System.exit(1); } @@ -26,16 +24,16 @@ public static void main(String[] args) throws IOException { // if the prefix doesn't exist you won't get any listings if (!Files.exists(s3Path)) { - logger.error("the prefix {} doesn't exist, you won't get any listings", s3Path); + System.err.printf("the prefix %s doesn't exist, you won't get any listings%n", s3Path); } //if it's not a directory you won't get any listings. if (!Files.isDirectory(s3Path)) { - logger.error("the path {} is not a directory, you won't get any listings", s3Path); + System.err.printf("the path %s is not a directory, you won't get any listings%n", s3Path); } try (var listed = Files.list(s3Path)) { - listed.forEach((p) -> logger.info(p.toString())); + listed.forEach(System.out::println); } } } diff --git a/src/examples/java/software/amazon/nio/spi/examples/Main.java b/src/examples/java/software/amazon/nio/spi/examples/Main.java index c1c59373..b462498a 100644 --- a/src/examples/java/software/amazon/nio/spi/examples/Main.java +++ b/src/examples/java/software/amazon/nio/spi/examples/Main.java @@ -9,27 +9,17 @@ import java.net.URI; import java.nio.file.Files; import java.nio.file.Paths; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Demo class that will read text from S3 URIs that you provide on the command line. Your standard AWS credential chain * is used for permissions. */ +@SuppressWarnings("CheckStyle") public class Main { - - private static final Logger logger = LoggerFactory.getLogger(Main.class); - - /** - * Demo main method - * - * @param args one or more S3 URIs to read - * @throws IOException if something goes wrong - */ public static void main(String[] args) throws IOException { if (args.length == 0) { - logger.error("Provide one or more S3 URIs to read from."); + System.err.println("Provide one or more S3 URIs to read from."); System.exit(1); } @@ -41,10 +31,10 @@ public static void main(String[] args) throws IOException { // proves that the correct path type is being used assert path.getClass().getName().contains("S3Path"); - logger.info("*** READING FROM {} ***", path.toUri()); + System.err.printf("*** READING FROM %s ***%n", path.toUri()); Files.readAllLines(path) - .forEach(logger::info); - logger.info("*** FINISHED READING OBJECT ***"); + .forEach(System.out::println); + System.err.println("*** FINISHED READING OBJECT ***"); } } } diff --git a/src/examples/java/software/amazon/nio/spi/examples/MoveObject.java b/src/examples/java/software/amazon/nio/spi/examples/MoveObject.java index c765cb68..7044786c 100644 --- a/src/examples/java/software/amazon/nio/spi/examples/MoveObject.java +++ b/src/examples/java/software/amazon/nio/spi/examples/MoveObject.java @@ -9,24 +9,22 @@ import java.net.URI; import java.nio.file.Files; import java.nio.file.Path; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Demonstrates a move operation using the `Files` class */ +@SuppressWarnings("CheckStyle") public class MoveObject { - private static final Logger logger = LoggerFactory.getLogger(MoveObject.class.getName()); public static void main(String[] args) throws IOException { if (args.length != 2) { - logger.error("Usage: java MoveObject "); + System.err.println("Usage: java MoveObject "); System.exit(1); } - logger.info("Moving {} to {}", args[0], args[1]); + System.err.printf("Moving %s to %s%n", args[0], args[1]); URI source = URI.create(args[0]); URI destination = URI.create(args[1]); diff --git a/src/examples/java/software/amazon/nio/spi/examples/ReadAllBytes.java b/src/examples/java/software/amazon/nio/spi/examples/ReadAllBytes.java index c0449725..56f0e0dd 100644 --- a/src/examples/java/software/amazon/nio/spi/examples/ReadAllBytes.java +++ b/src/examples/java/software/amazon/nio/spi/examples/ReadAllBytes.java @@ -10,19 +10,15 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +@SuppressWarnings("CheckStyle") public class ReadAllBytes { - - private static final Logger logger = LoggerFactory.getLogger(ReadAllBytes.class); - public static void main(String[] args) throws IOException { var filePath = Paths.get(URI.create(args[0])); final var bytes = Files.readAllBytes(filePath); // assumes this is a text file final var data = new String(bytes, StandardCharsets.UTF_8); - logger.info(data); + System.out.println(data); } } diff --git a/src/examples/java/software/amazon/nio/spi/examples/WalkFromRoot.java b/src/examples/java/software/amazon/nio/spi/examples/WalkFromRoot.java index 2f5c2cd4..58c92084 100644 --- a/src/examples/java/software/amazon/nio/spi/examples/WalkFromRoot.java +++ b/src/examples/java/software/amazon/nio/spi/examples/WalkFromRoot.java @@ -10,13 +10,10 @@ import java.net.URI; import java.nio.file.Files; import java.nio.file.Paths; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +@SuppressWarnings("CheckStyle") public class WalkFromRoot { - private static final Logger logger = LoggerFactory.getLogger(WalkFromRoot.class); - /** * Walks a bucket from the root listing all directories and files. Internally uses the {@code S3FileSystemProvider}'s * {@code newDirectoryStream()} method which uses asynchronous paginated calls to S3. @@ -27,7 +24,7 @@ public class WalkFromRoot { public static void main(String[] args) throws IOException { if (args.length < 1) { - logger.error("Provide a bucket name to walk"); + System.err.println("Provide a bucket name to walk"); System.exit(1); } @@ -38,13 +35,12 @@ public static void main(String[] args) throws IOException { var root = Paths.get(URI.create(bucketName)); - logger.info("root.getClass() = {}", root.getClass()); var s3 = root.getFileSystem(); for (var rootDir : s3.getRootDirectories()) { try (var pathStream = Files.walk(rootDir)) { - pathStream.forEach((p) -> logger.info(p.toString())); + pathStream.forEach(System.out::println); } }