Repository navigation
fix(java): add warning in replaceAllObjects for empty objects - #6607
Merged
Merged
Conversation
Contributor
💥 Breaking changes detected !!Either this PR or a previous PR not released yet introduced breaking changes, be careful when merging. ✔️ Code generated!
📊 Benchmark resultsBenchmarks performed on the method using a mock server, the results might not reflect the real-world performance.
|
algolia-api-clients-automation-bot Bot
added a commit
that referenced
this pull request
Jun 26, 2026
… (generated) [skip ci] Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-java
that referenced
this pull request
Jun 26, 2026
…ted) algolia/api-clients-automation#6607 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
This was referenced Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🧭 What and Why
🎟 JIRA Ticket: API-500
Stemming from CR-11510: a customer wiped an index by calling
replaceAllObjectswith an empty list. The helper copies the source index's settings/synonyms/rules to a temp index, batches zero records into it, then moves the temp index over the source — leaving the original index empty. This happened silently, with no warning.This adds a warning-level log when
replaceAllObjects(and itsreplaceAllObjectsWithTransformationsibling) is called with an empty list of objects. Behavior is unchanged — the call still proceeds; it only warns.This is the Java client; the other clients are handled in their own PRs.
Changes included:
WARNING(viajava.util.logging) when theobjectscollection is empty, added to the canonicalreplaceAllObjectsandreplaceAllObjectsWithTransformationimplementations. All overloads delegate down to these, so every call path is covered:replaceAllObjects was called with an empty list of objects, which will delete all records currently in the "<indexName>" index.Collection.isEmpty()when possible and falls back toiterator().hasNext()for non-CollectionIterables, so single-use iterables aren't consumed by the check.Warningnote to thereplaceAllObjectsJavadoc so the behavior surfaces in IDE hover/autocomplete at write-time.Out of scope
docs-newrepo and is updated separately.🧪 Test
:algoliasearch:compileJava --rerun-tasks→ BUILD SUCCESSFUL).