fix(rest-api): forward path params in ESIndexResource create/mod endpoints (#35635)#36260
Conversation
…oints (#35635) createIndex y los endpoints @deprecated hermanos capturaban @PathParam("params") pero invocaban el overload auth(request,response) de 2 args, que reenviaba null; el mapa de params quedaba vacío y createIndex respondía HTTP 500 (NumberFormatException en shards). Se reenvía params al auth de 3 args y se devuelve HTTP 400 ante un shards faltante/inválido en vez de un 500 opaco. Refs: #35635 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
❌ Linked Issue Needs Team LabelThis PR is linked to issue #35635, but that issue has no How to fix this:Apply a This comment was automatically generated by the issue linking workflow |
|
Claude finished @fabrizzio-dotCMS's task in 1m 4s —— View job Rollback Safety Analysis
Result: ✅ Safe to Roll BackThe diff touches exactly one file: Checked against every category in the rollback-unsafe reference:
Summary: All changes are pure Java application logic corrections — forwarding |
🤖 Bedrock Review —
|
|
Tick the box to add this pull request to the merge queue (same as
|
Proposed Changes
Fixes the TC-005 blocker reported in #35635:
PUT /api/v1/esindex/create/{params:.*}returned HTTP 500 on every call, making it impossible for QA to validate thethreadSafeTimestampFormatterthread-safety work.Root cause
createIndexcaptures the URL into@PathParam("params") String params, but invokes the 2-argumentauth(request, response)overload, which forwardsnullinstead ofparamstoWebResource. As a resultgetParamsMap()is built overBLANKand is always empty →getParamsMap().get("shards")isnull→Integer.parseInt(null)throwsNumberFormatException→ HTTP 500. The capturedparamswas effectively dead code.The five sibling
@DeprecatedPUT endpoints (clearIndex,activateIndex,deactivateIndex,closeIndex,openIndex) share the identical defect — they read the index name fromgetParamsMap(), which always arrived empty, so they silently operated on anullindex (returning 404 / erroring instead of acting).Fix
createIndexand the five sibling endpoints now forward the capturedparamsto the 3-argauth(request, response, params)overload (the same pattern already used bygetActive).createIndexnow returns HTTP 400 with a clear message whenshardsis missing or non-numeric, instead of an opaque 500.Issue
This PR fixes a defect
How to test
Manual (TC-005):
Expected: 20× HTTP 200, 20 unique well-formed index names. A missing/invalid
shardsnow yields HTTP 400 (not 500).🤖 Generated with Claude Code
This PR fixes: #35635