This is an automated email from the ASF dual-hosted git repository. tilman pushed a commit to branch branch_3x in repository https://gitbox.apache.org/repos/asf/tika.git
commit b4f8ae8b07b40e0de211a481cd36ae3642870753 Author: Tilman Hausherr <[email protected]> AuthorDate: Sat Oct 25 12:50:19 2025 +0200 TIKA-4525: simplify getObject, as suggested by ChatGPT --- .../org/apache/tika/pipes/s3/tests/S3PipeIntegrationTest.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tika-integration-tests/tika-pipes-s3-integration-tests/src/test/java/org/apache/tika/pipes/s3/tests/S3PipeIntegrationTest.java b/tika-integration-tests/tika-pipes-s3-integration-tests/src/test/java/org/apache/tika/pipes/s3/tests/S3PipeIntegrationTest.java index eed188dbd..727883450 100644 --- a/tika-integration-tests/tika-pipes-s3-integration-tests/src/test/java/org/apache/tika/pipes/s3/tests/S3PipeIntegrationTest.java +++ b/tika-integration-tests/tika-pipes-s3-integration-tests/src/test/java/org/apache/tika/pipes/s3/tests/S3PipeIntegrationTest.java @@ -41,7 +41,7 @@ import org.testcontainers.containers.ComposeContainer; import org.testcontainers.junit.jupiter.Testcontainers; import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; -import software.amazon.awssdk.core.ResponseInputStream; +import software.amazon.awssdk.core.ResponseBytes; import software.amazon.awssdk.core.checksums.RequestChecksumCalculation; import software.amazon.awssdk.core.sync.RequestBody; import software.amazon.awssdk.regions.Region; @@ -152,11 +152,10 @@ class S3PipeIntegrationTest { for (String testFile : testFiles) { GetObjectRequest objectRequest = GetObjectRequest.builder().bucket(EMIT_BUCKET).key(testFile + ".json").build(); - ResponseInputStream<GetObjectResponse> object = s3Client.getObject(objectRequest); - Assertions.assertNotNull(object); - String data = IOUtils.toString(object, StandardCharsets.UTF_8); - Assertions.assertTrue(data.contains("body-of-" + testFile), - "Should be able to read the parsed body of the HTML file as the body of the document"); + ResponseBytes<GetObjectResponse> objectAsBytes = s3Client.getObjectAsBytes(objectRequest); + String data = objectAsBytes.asString(StandardCharsets.UTF_8); + Assertions.assertTrue(data.contains("body-of-" + testFile), + "Should be able to read the parsed body of the HTML file as the body of the document"); } }
