elastic / elasticsearch

Free and Open Source, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
69.59k stars 24.63k forks source link

NPE when calling _capabilities without `path` parameter #113323

Open smalyshev opened 4 hours ago

smalyshev commented 4 hours ago

Elasticsearch Version

9.0.0-SNAPSHOT

Installed Plugins

No response

Java Version

21

OS Version

*

Problem Description

If _capabilities API is called without any parameters, this results in 500 with NPE:

"root_cause": [
      {
        "type": "null_pointer_exception",
        "reason": "Cannot invoke \"String.length()\" because \"s\" is null"
      }
    ]

Steps to Reproduce

GET http://localhost:9200/_capabilities

Logs (if relevant)

[2024-09-20T16:56:19,912][WARN ][r.suppressed             ] [node-1] path: /_capabilities, params: {}, status: 500java.lang.NullPointerException: Cannot invoke "String.length()" because "s" is null
    at java.base/java.net.URLDecoder.decode(URLDecoder.java:173)
    at org.elasticsearch.server@9.0.0-SNAPSHOT/org.elasticsearch.rest.action.admin.cluster.RestNodesCapabilitiesAction.prepareRequest(RestNodesCapabilitiesAction.java:59)
    at org.elasticsearch.server@9.0.0-SNAPSHOT/org.elasticsearch.rest.BaseRestHandler.handleRequest(BaseRestHandler.java:104)
    at org.elasticsearch.server@9.0.0-SNAPSHOT/org.elasticsearch.rest.RestController$1.onResponse(RestController.java:501)
    at org.elasticsearch.server@9.0.0-SNAPSHOT/org.elasticsearch.rest.RestController$1.onResponse(RestController.java:495)
elasticsearchmachine commented 4 hours ago

Pinging @elastic/es-core-infra (Team:Core/Infra)