Internal server error deleting a non-existing glossary entry

Description

Deleting an item in glossary that was already deleted should not cause an internal server error.

> ~/dev/zanata-platform/client/zanata-cli/target/appassembler/bin/zanata-cli -e glossary-delete --id 977
[INFO] Loading config from zanata.xml
[INFO] Loading user config from ~/.config/zanata.ini
[INFO] Error stacktraces are turned on.
[INFO] client API version: 4.0.0-SNAPSHOT, server API version: 4.0.0-SNAPSHOT
[INFO] Server: http://localhost:8180/
[INFO] Username: admin
[INFO] Entry id to delete: 977
[INFO] Delete entire glossary?: false
[ERROR] Execution failed:
javax.ws.rs.client.ResponseProcessingException: javax.ws.rs.ServerErrorException: operation to http://localhost:8180/rest/glossary/entries/977?qualifiedName=global%2Fdefault returned 500 (Internal Server Error)::<html><head><title>Error</title></head><body>Internal Server Error</body></html>
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:455)
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocationBuilder.delete(ClientInvocationBuilder.java:213)
at org.zanata.rest.client.GlossaryClient.delete(GlossaryClient.java:82)
at org.zanata.client.commands.glossary.delete.GlossaryDeleteCommand.run(GlossaryDeleteCommand.java:87)
at org.zanata.client.commands.ConfigurableCommand.runWithActions(ConfigurableCommand.java:110)
at org.zanata.client.commands.ArgsUtil.runCommand(ArgsUtil.java:48)
at org.zanata.client.ZanataClient.processArgs(ZanataClient.java:177)
at org.zanata.client.ZanataClient.main(ZanataClient.java:102)
Caused by: javax.ws.rs.ServerErrorException: operation to http://localhost:8180/rest/glossary/entries/977?qualifiedName=global%2Fdefault returned 500 (Internal Server Error)::<html><head><title>Error</title></head><body>Internal Server Error</body></html>
at org.zanata.rest.client.ResponseStatusFilter.filter(ResponseStatusFilter.java:89)
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:447)
... 7 more

Environment

None

Activity

Show:
Sean Flanigan
December 12, 2016, 6:27 AM

HTTP DELETE calls are supposed to be idempotent, but the question is: does that refer to the response code or the state of the system? http://leedavis81.github.io/is-a-http-delete-requests-idempotent/ http://stackoverflow.com/questions/2342579/http-status-code-for-update-and-delete

Either way, returning 500 is definitely wrong.

In GlossaryResource, DELETE for a single entry actually returns 200 with the deleted glossary entry, which I think it a bit of a mistake (204 with no content would have been better). We can't return 200 with the deleted entry if it was deleted previously, so we should probably return 404 if we can't find the entry to delete.

Sachin Pathare
December 26, 2016, 5:11 AM

verified in platform-4.0.0

Ready for Release

Assignee

Damian Jansen

Reporter

Damian Jansen

Labels

Tested Version/s

None

Components

Sprint

None

Fix versions

Affects versions

Priority

unspecified
Configure