Skip to content

Sending a body on /api/v1/begin/{database} with missing key isolationLevel should return HTTP 400 not an error #1698

@ExtReMLapin

Description

@ExtReMLapin

Hello 👋🏻

ArcadeDB Version:

ArcadeDB Server v24.6.1 (build fbc1c77c7e1c52197abdd8661e5b34749babf3d6/1721708610769/main)

Latest release

OS and JDK Version:

Running on Linux 6.5.0-41-generic - OpenJDK 64-Bit Server VM 11.0.23

Expected behavior

No error or error 4xx because of unexpected body

Actual behavior

When sending a (valid JSON) body on the /begin/ endpoint (which makes no sense, I know) it should either give a error 4xx or ignore the body.

I recycled an old request so the auth login:password was still there in POSTMAN, I just changed the endpoint to test the solution proposed in #1691 .

Issue is that there was still the "command" json object from it, which caused the following error, while it's not an real critical issue, and it errors also with an empty json object { }, it still find it a little strange it errors instead of giving a 2xx or 4xx.

août 19 07:54:15 cfia-IDEXTEND server.sh[4718]: java.lang.NullPointerException: Name is null
août 19 07:54:15 cfia-IDEXTEND server.sh[4718]:         at java.base/java.lang.Enum.valueOf(Enum.java:238)
août 19 07:54:15 cfia-IDEXTEND server.sh[4718]:         at com.arcadedb.database.Database$TRANSACTION_ISOLATION_LEVEL.valueOf(Database.java:39)
août 19 07:54:15 cfia-IDEXTEND server.sh[4718]:         at com.arcadedb.server.http.handler.PostBeginHandler.execute(PostBeginHandler.java:59)
août 19 07:54:15 cfia-IDEXTEND server.sh[4718]:         at com.arcadedb.server.http.handler.DatabaseAbstractHandler.execute(DatabaseAbstractHandler.java:100)
août 19 07:54:15 cfia-IDEXTEND server.sh[4718]:         at com.arcadedb.server.http.handler.AbstractServerHttpHandler.handleRequest(AbstractServerHttpHandler.java:127)
août 19 07:54:15 cfia-IDEXTEND server.sh[4718]:         at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
août 19 07:54:15 cfia-IDEXTEND server.sh[4718]:         at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
août 19 07:54:15 cfia-IDEXTEND server.sh[4718]:         at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
août 19 07:54:15 cfia-IDEXTEND server.sh[4718]:         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
août 19 07:54:15 cfia-IDEXTEND server.sh[4718]:         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1512)
août 19 07:54:15 cfia-IDEXTEND server.sh[4718]:         at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
août 19 07:54:15 cfia-IDEXTEND server.sh[4718]:         at java.base/java.lang.Thread.run(Thread.java:829)

Steps to reproduce

curl -X POST http://localhost:2480/api/v1/begin/YOUR_DB -d "{ }" --user login:password

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions