Skip to content

Commit 37186b6

Browse files
hive-botclaude
andcommitted
docs: note the wait timeout and correct the unreleased changelog entries
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent d243722 commit 37186b6

2 files changed

Lines changed: 42 additions & 37 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88
### Added
9-
- `DeepLClientOptions` overrides every setter with a `DeepLClientOptions`
10-
return type, so `DeepLClientOptions options = new
11-
DeepLClientOptions().setMaxRetries(1)` compiles as in the README, and a
12-
setter chain passed inline to `DeepLClient` no longer resolves to the
13-
deprecated `DeepLClient(String, TranslatorOptions)` constructor.
149
- Added `getStatusString()` to `TranslationMemoryJob` and
1510
`TranslationMemoryJobResult`, returning the job status as the API sent it,
1611
including values not in `TranslationMemoryJobResult.Status` (for which
@@ -204,13 +199,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
204199
- `TranslationMemoryJob.getProduct()`, `getOperation()`, `getCreationTime()`
205200
and `getUpdatedTime()` are no longer annotated `@Nullable`, as the API always
206201
returns these fields.
207-
- The bare target languages `en` and `pt` are no longer rejected
208-
client-side in text translation, document translation and rephrasing. The
209-
API translates them to `en-US` and `pt-PT` respectively.
202+
- The bare target languages `en` and `pt` are now accepted in text
203+
translation, document translation and rephrasing (the API uses `en-US` and
204+
`pt-PT`); previously they were rejected with an `IllegalArgumentException`.
210205
- `getSourceLanguages()`, `getTargetLanguages()`, `getLanguages()` and
211206
`getGlossaryLanguages()` now use `GET /v3/languages` instead of the
212207
deprecated v2 endpoints. The returned lists may contain additional
213208
languages, including the bare `en` and `pt` as target languages.
209+
`setApiVersion()` no longer applies to these calls; previously a v1 setting
210+
also changed their path.
211+
- Connection resets, broken pipes and a response body cut off mid-read are now
212+
retried up to `maxRetries`, and `ConnectionException.getShouldRetry()`
213+
returns `true` for them; previously they failed at once. Developer key
214+
creation still does not retry a cut-off body.
215+
- Refused connections, unreachable hosts and failed DNS lookups are now retried
216+
up to `maxRetries` like timeouts, in all request types including `PATCH`;
217+
previously they failed at once.
218+
- A failure while reading the response body, for example a read timeout, now
219+
throws a `ConnectionException` and is retried up to `maxRetries`; previously
220+
it threw a `DeepLException` and was not retried.
221+
- `GlossaryEntries` now stores and sends terms trimmed of leading and trailing
222+
whitespace (`Character.isWhitespace()`), so `get(" foo ")` no longer finds an
223+
entry added as `" foo "`; previously terms were stored as given. Target terms
224+
set through `replaceAll()` or `Map.Entry.setValue()` are now checked, and an
225+
invalid character is named in hexadecimal (`U+001F`).
226+
- A document status the library does not know yet now counts as in progress:
227+
`translateDocumentWaitUntilDone()` and `translateDocument()` keep polling and
228+
`DocumentStatus.getStatus()` returns `null`; previously they stopped with
229+
"Unknown error". Pass a timeout to bound the wait.
230+
- `DeepLClientOptions` setters now return `DeepLClientOptions`; previously they
231+
returned `TranslatorOptions`, so `DeepLClientOptions options = new
232+
DeepLClientOptions().setMaxRetries(1)` did not compile and an inline setter
233+
chain resolved to the deprecated `DeepLClient(String, TranslatorOptions)`
234+
constructor.
235+
- HTTP 401 now throws `AuthorizationException`, like HTTP 403; previously a
236+
`DeepLException` with "Unknown error".
237+
- A malformed or empty API response now throws a `DeepLException`; previously a
238+
`JsonSyntaxException` or `NullPointerException`.
239+
- A whitespace-only auth key is now rejected by the `DeepLClient` and
240+
`Translator` constructors with an `IllegalArgumentException`; previously it
241+
was sent and failed at the API.
214242

215243
### Deprecated
216244
- `createStyleRule(String, String, ConfiguredRules, List)` and
@@ -248,10 +276,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
248276
document (`translateDocumentDownload()`) or translation memory export
249277
(`downloadTranslationMemoryExport()`) is now retried up to `maxRetries` while
250278
nothing has been written to the output yet.
251-
- A response body cut off mid-read (the connection closed before the body was
252-
complete) is now retried like a connection reset, and
253-
`ConnectionException.getShouldRetry()` returns `true` for it. Developer key
254-
creation still does not retry it, as the request was already sent.
255279
- An error response of the form `{"error": {"message": "..."}}` now puts its
256280
message into the exception message; an error body without any message is
257281
appended as the raw body instead of an empty `error message: `.
@@ -264,8 +288,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
264288
`User-Agent` in any casing, e.g. `user-agent`.
265289
- `PATCH` requests no longer make up to 3 hidden extra attempts per try on top
266290
of `maxRetries`.
267-
- Connection resets and broken pipes are now retried, and
268-
`ConnectionException.getShouldRetry()` returns `true` for them.
269291
- The language query parameters of `getMultilingualGlossaryDictionaryEntries()`
270292
and `deleteMultilingualGlossaryDictionary()` now encode a space as `%20`
271293
instead of `+`.
@@ -275,10 +297,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
275297
- `translateDocumentDownload()` maps an error response without body by its
276298
status, for example to `QuotaExceededException` or
277299
`DocumentNotReadyException`, instead of a plain `DeepLException`.
278-
- `GlossaryEntries` stores and sends trimmed terms, trims all whitespace
279-
(`Character.isWhitespace()`) like spoken terms, checks target terms set
280-
through `replaceAll()` or `Map.Entry.setValue()`, and names an invalid
281-
character in hexadecimal (`U+001F`).
282300
- `exportTranslationMemoryToFilepath()` with a `File` now checks the output
283301
path before it creates the export job: an existing file throws `IOException`
284302
and a missing directory `FileNotFoundException`, the same classes as before.
@@ -305,10 +323,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
305323
contain one complete result per input text. Before, the single-text
306324
overload threw an `IndexOutOfBoundsException` or returned `null`, and the
307325
list overload returned a short list.
308-
- A document status the library does not know yet no longer stops
309-
`translateDocumentWaitUntilDone()` and `translateDocument()` with
310-
"Unknown error": it counts as in progress and polling continues.
311-
`DocumentStatus.getStatus()` returns `null` for it.
312326
- `translateDocumentGetStatus()` and `translateDocumentDownload()` now
313327
URL-encode the document ID in the request path.
314328
- `translateDocumentUpload()` and `translateDocument()` with an input stream
@@ -319,22 +333,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
319333
- `translateText()` no longer fails when a translation in the response has no
320334
`billed_characters` (`getBilledCharacters()` returns 0) or a `null`
321335
`model_type_used` (`getModelTypeUsed()` returns `null`).
322-
- HTTP 401 now throws `AuthorizationException`, like HTTP 403, instead of a
323-
`DeepLException` with "Unknown error".
324-
- Connection failures (refused connections, unreachable hosts) and failed DNS
325-
lookups are now retried like timeouts, in all request types including
326-
`PATCH`.
327336
- Developer key creation is now also retried after a refused connection or a
328337
connect timeout, in addition to HTTP 429 and DNS failures, as the request was
329338
not sent in these cases. A timeout or connection reset after the request was
330339
sent is still not retried.
331-
- A failure while reading the response body, for example a read timeout, now
332-
throws a `ConnectionException` and is retried. It threw a non-retried
333-
`DeepLException` before.
334-
- A whitespace-only auth key is now rejected by the `DeepLClient` and
335-
`Translator` constructors with an `IllegalArgumentException`.
336-
- A malformed or empty API response now throws a `DeepLException` instead of
337-
a `JsonSyntaxException` or `NullPointerException`.
338340
- Fixed the doc comments of `LanguageCode.English` and
339341
`LanguageCode.Portuguese`, which claimed they may only be used as source
340342
languages.

‎README.md‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,9 @@ until the document is done; an overload taking a `Duration` timeout throws a
383383
`getStatus()` (a `DocumentStatus.StatusCode`, or `null` for a status the
384384
library does not know yet), `getStatusString()` (the status as the API sent
385385
it), `ok()` (not failed) and `done()` (succeeded). An unknown status counts as
386-
in progress, so waiting continues.
386+
in progress, so waiting continues. The wait has no default limit, so pass a
387+
timeout (`translateDocumentWaitUntilDone(handle, Duration)` or
388+
`DocumentTranslationOptions.setTimeout()`) to bound it.
387389

388390
The source and target language codes are sent with the language part
389391
lower-cased and the rest as given, for example `zh-Hans`.
@@ -1399,8 +1401,9 @@ the status as the API sent it. Both are also available on
13991401
Note that an import job keeps reporting `AwaitingInput` for a while after its
14001402
file has been uploaded, because the API detects the upload asynchronously.
14011403
`waitUntilTranslationMemoryJobDone()` polls through that status like any other
1402-
non-terminal one. A job whose file is never uploaded does not finish on its own,
1403-
so pass a timeout when that is a possibility.
1404+
non-terminal one, and an unknown status also keeps polling. A job whose file is
1405+
never uploaded does not finish on its own, and the wait has no default limit, so
1406+
pass a timeout to bound it.
14041407

14051408
#### Exporting a translation memory
14061409

0 commit comments

Comments
 (0)