Skip to content

Commit 43fd666

Browse files
committed
Update error message
1 parent db1326c commit 43fd666

6 files changed

Lines changed: 18 additions & 18 deletions

File tree

core/sdk-core/src/main/java/software/amazon/awssdk/core/FileTransformerConfiguration.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public static Builder builder() {
105105
* <p>
106106
* Always create a new file. If the file already exists, {@link FileAlreadyExistsException} will be thrown.
107107
* In the event of an error, the SDK will attempt to delete the file (whatever has been written to it so far).
108-
* The parent directory must already exist; the SDK will not auto-create it.
108+
* The file's parent directories must already exist; the SDK will not auto-create them.
109109
*/
110110
public static FileTransformerConfiguration defaultCreateNew() {
111111
return builder().fileWriteOption(FileWriteOption.CREATE_NEW)
@@ -118,7 +118,7 @@ public static FileTransformerConfiguration defaultCreateNew() {
118118
* <p>
119119
* Create a new file if it doesn't exist, otherwise replace the existing file.
120120
* In the event of an error, the SDK will NOT attempt to delete the file, leaving it as-is.
121-
* The parent directory must already exist; the SDK will not auto-create it.
121+
* The file's parent directories must already exist; the SDK will not auto-create them.
122122
*/
123123
public static FileTransformerConfiguration defaultCreateOrReplaceExisting() {
124124
return builder().fileWriteOption(FileWriteOption.CREATE_OR_REPLACE_EXISTING)
@@ -131,7 +131,7 @@ public static FileTransformerConfiguration defaultCreateOrReplaceExisting() {
131131
* <p>
132132
* Create a new file if it doesn't exist, otherwise append to the existing file.
133133
* In the event of an error, the SDK will NOT attempt to delete the file, leaving it as-is.
134-
* The parent directory must already exist; the SDK will not auto-create it.
134+
* The file's parent directories must already exist; the SDK will not auto-create them.
135135
*/
136136
public static FileTransformerConfiguration defaultCreateOrAppend() {
137137
return builder().fileWriteOption(FileWriteOption.CREATE_OR_APPEND_TO_EXISTING)
@@ -182,19 +182,19 @@ public int hashCode() {
182182
public enum FileWriteOption {
183183
/**
184184
* Always create a new file. If the file already exists, {@link FileAlreadyExistsException} will be thrown.
185-
* The parent directory must already exist; the SDK will not auto-create it.
185+
* The file's parent directories must already exist; the SDK will not auto-create them.
186186
*/
187187
CREATE_NEW,
188188

189189
/**
190190
* Create a new file if it doesn't exist, otherwise replace the existing file.
191-
* The parent directory must already exist; the SDK will not auto-create it.
191+
* The file's parent directories must already exist; the SDK will not auto-create them.
192192
*/
193193
CREATE_OR_REPLACE_EXISTING,
194194

195195
/**
196196
* Create a new file if it doesn't exist, otherwise append to the existing file.
197-
* The parent directory must already exist; the SDK will not auto-create it.
197+
* The file's parent directories must already exist; the SDK will not auto-create them.
198198
*/
199199
CREATE_OR_APPEND_TO_EXISTING,
200200

core/sdk-core/src/main/java/software/amazon/awssdk/core/async/AsyncResponseTransformer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ default String name() {
177177
* SDK will attempt to delete the file (whatever has been written to it so far). If the file already exists, an exception will
178178
* be thrown.
179179
*
180-
* <p>The parent directory must already exist. The SDK will not auto-create parent directories, and a
180+
* <p>The file's parent directories must already exist. The SDK will not auto-create directories, and a
181181
* {@link java.nio.file.NoSuchFileException} will be thrown if they are missing.
182182
*
183183
* @param path Path to file to write to.
@@ -193,7 +193,7 @@ static <ResponseT> AsyncResponseTransformer<ResponseT, ResponseT> toFile(Path pa
193193
* Creates an {@link AsyncResponseTransformer} that writes all the content to the given file with the specified
194194
* {@link FileTransformerConfiguration}.
195195
*
196-
* <p>The parent directory must already exist. The SDK will not auto-create parent directories, and a
196+
* <p>The file's parent directories must already exist. The SDK will not auto-create directories, and a
197197
* {@link java.nio.file.NoSuchFileException} will be thrown if they are missing.
198198
*
199199
* @param path Path to file to write to.
@@ -223,7 +223,7 @@ static <ResponseT> AsyncResponseTransformer<ResponseT, ResponseT> toFile(
223223
* SDK will attempt to delete the file (whatever has been written to it so far). If the file already exists, an exception will
224224
* be thrown.
225225
*
226-
* <p>The parent directory must already exist. The SDK will not auto-create parent directories, and a
226+
* <p>The file's parent directories must already exist. The SDK will not auto-create directories, and a
227227
* {@link java.nio.file.NoSuchFileException} will be thrown if they are missing.
228228
*
229229
* @param file File to write to.

core/sdk-core/src/main/java/software/amazon/awssdk/core/internal/async/FileAsyncResponseTransformer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ private AsynchronousFileChannel createChannel(Path path) throws IOException {
133133
throw e;
134134
}
135135
throw new NoSuchFileException(e.getFile(), e.getOtherFile(),
136-
"Verify that the parent directory exists. The SDK will not auto-create it.");
136+
"Verify that the file's parent directories exist. The SDK will not auto-create them.");
137137
}
138138
}
139139

core/sdk-core/src/main/java/software/amazon/awssdk/core/sync/ResponseTransformer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ default String name() {
111111
* Creates a response transformer that writes all response content to the specified file. If the file already exists
112112
* then a {@link FileAlreadyExistsException} will be thrown.
113113
*
114-
* <p>The parent directory must already exist. The SDK will not auto-create parent directories, and a
114+
* <p>The file's parent directories must already exist. The SDK will not auto-create directories, and a
115115
* {@link NoSuchFileException} will be thrown if they are missing.
116116
*
117117
* @param path Path to file to write to.
@@ -173,8 +173,8 @@ static boolean shouldThrowIOException(IOException copyException) {
173173
static String copyErrorMessage(Path path, IOException copyException) {
174174
String baseMessage = "Failed to read response into file: " + path;
175175
if (copyException instanceof NoSuchFileException) {
176-
return baseMessage + ". Verify that the parent directory exists."
177-
+ " The SDK will not auto-create it.";
176+
return baseMessage + ". Verify that the file's parent directories exist."
177+
+ " The SDK will not auto-create them.";
178178
}
179179
return baseMessage;
180180
}
@@ -183,7 +183,7 @@ static String copyErrorMessage(Path path, IOException copyException) {
183183
* Creates a response transformer that writes all response content to the specified file. If the file already exists
184184
* then a {@link FileAlreadyExistsException} will be thrown.
185185
*
186-
* <p>The parent directory must already exist. The SDK will not auto-create parent directories, and a
186+
* <p>The file's parent directories must already exist. The SDK will not auto-create directories, and a
187187
* {@link NoSuchFileException} will be thrown if they are missing.
188188
*
189189
* @param file File to write to.

core/sdk-core/src/test/java/software/amazon/awssdk/core/internal/async/FileAsyncResponseTransformerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ void parentDirectoryDoesNotExist_throwsWithHelpfulMessage(FileTransformerConfigu
339339
assertThat(future).failsWithin(1, TimeUnit.SECONDS)
340340
.withThrowableOfType(ExecutionException.class)
341341
.withCauseInstanceOf(NoSuchFileException.class)
342-
.withMessageContaining("Verify that the parent directory exists")
343-
.withMessageContaining("The SDK will not auto-create it");
342+
.withMessageContaining("Verify that the file's parent directories exist")
343+
.withMessageContaining("The SDK will not auto-create them");
344344
}
345345

346346
@Test

core/sdk-core/src/test/java/software/amazon/awssdk/core/sync/ResponseTransformerToFileTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ void toFile_parentDirectoryDoesNotExist_throwsWithHelpfulMessage() throws Except
4343

4444
assertThatThrownBy(() -> transformer.transform("response", inputStream))
4545
.isInstanceOf(IOException.class)
46-
.hasMessageContaining("Verify that the parent directory exists")
47-
.hasMessageContaining("The SDK will not auto-create it")
46+
.hasMessageContaining("Verify that the file's parent directories exist")
47+
.hasMessageContaining("The SDK will not auto-create them")
4848
.hasCauseInstanceOf(NoSuchFileException.class);
4949
}
5050
}

0 commit comments

Comments
 (0)