Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ExtReMLapin opened this issue Aug 19, 2024 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ExtReMLapin
Copy link
Contributor

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

@ExtReMLapin ExtReMLapin changed the title Sending a (unexpected) body on /api/v1/begin/{database} will cause an error Sending a body on /api/v1/begin/{database} with missing key isolationLevel should return HTTP 400 not an error Aug 19, 2024
@lvca lvca self-assigned this Aug 19, 2024
@lvca lvca added this to the 24.8.1 milestone Aug 19, 2024
@lvca lvca added the bug Something isn't working label Aug 19, 2024
@lvca
Copy link
Contributor

lvca commented Aug 19, 2024

The begin can take a payload looking for the parameter "isolationLevel". It's an issue, if no isolationLevel is found it should use the default settings.

lvca added a commit that referenced this issue Aug 19, 2024
@lvca
Copy link
Contributor

lvca commented Aug 19, 2024

Fixed. Now if the payload is present but isolationLevel is missing, a 400 error is returned

@lvca lvca closed this as completed Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants