Skip to content

TIKA-4526 - Fix nondeterministic failures in TranslateResourceTest by splitting @PUT/@POST handlers - #2368

Merged
THausherr merged 1 commit into
apache:mainfrom
LucaDai:Fix-nondeterministic-failures-in-TranslateResourceTest
Oct 21, 2025
Merged

TIKA-4526 - Fix nondeterministic failures in TranslateResourceTest by splitting @PUT/@POST handlers#2368
THausherr merged 1 commit into
apache:mainfrom
LucaDai:Fix-nondeterministic-failures-in-TranslateResourceTest

Conversation

@LucaDai

@LucaDai LucaDai commented Oct 20, 2025

Copy link
Copy Markdown
Contributor

Description

**Issue: [TIKA-4526]

Type of change

  • New feature
  • Bug fix for existing feature
  • Code quality improvement
  • Addition or Improvement of tests
  • Addition/Improvement of documentation

Summary

The failure was caused by ambiguous method mappings in TranslateResource, where both the translate and autoTranslate methods were annotated with both @put and @post at the same time.

A similar issue was fixed in the previous merged PR, which included a detailed explanation and how to reproduce:
#2360

Related Tests

org.apache.tika.server.core.TranslateResourceTest.testTranslateFull
org.apache.tika.server.core.TranslateResourceTest.testTranslateAutoLang

Verification

  • mvn test -pl tika-server/tika-server-core passes.
  • ✅ Multiple NonDex runs (-DnondexRuns=100) pass with no flakes.
  • ✅ Checkstyle passes.
  • ✅ No behavior change to REST paths or media types; only internal method split and safer input handling.

Please let me know if anything needs to change regarding the code style.

@THausherr

Copy link
Copy Markdown
Contributor

There's still some double code in the language detection. Can you please add another intermediate method for that? E.g. doAutoTranslate() that calls doTranslate().

@LucaDai
LucaDai force-pushed the Fix-nondeterministic-failures-in-TranslateResourceTest branch from 64db16b to 1fca31e Compare October 20, 2025 15:12
@LucaDai

LucaDai commented Oct 20, 2025

Copy link
Copy Markdown
Contributor Author

There's still some double code in the language detection. Can you please add another intermediate method for that? E.g. doAutoTranslate() that calls doTranslate().

Thank you for reviewing this PR! I added the doAutoTranslate() method, please check again.

@THausherr
THausherr merged commit f24204d into apache:main Oct 21, 2025
1 check passed
asf-gitbox-commits pushed a commit that referenced this pull request Oct 21, 2025
…splitting @PUT/@post handlers (#2368)

Co-authored-by: LucaD <lucadai.dev@gmail.com>
@LucaDai
LucaDai deleted the Fix-nondeterministic-failures-in-TranslateResourceTest branch November 10, 2025 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants