freme-project / e-Link

Apache License 2.0
0 stars 0 forks source link

'documents': error when template ID is not a long #55

Closed pheyvaer closed 9 years ago

pheyvaer commented 9 years ago

e.g., a string instead of a long. This should result in a bad request exception.

Same for templates/{tempalteid}.

m1ci commented 9 years ago

for /documents - if you specify string for templateid you receive

{
  "exception": "org.springframework.beans.TypeMismatchException",
  "path": "/e-link/documents",
  "message": "Failed to convert value of type 'java.lang.String' to required type 'long'; nested exception is java.lang.NumberFormatException: For input string: \"dsad\"",
  "error": "Internal Server Error",
  "status": 500,
  "timestamp": 1445870485848
}

similar error is returned when you want to retrieve template with ID of type string.

IMO its clear that there is NumberFormatException and that the required type is long. Or?

pheyvaer commented 9 years ago

the error is clear, but should the status code not be 400 instead of 500? bc the error is caused by the user and the not the server?

m1ci commented 9 years ago

its caused by the server: org.springframework.beans.TypeMismatchException

jnehring commented 9 years ago

I also think this should be 400 - bad request. This error seems to be thrown by spring so I will try to fix it.

jnehring commented 9 years ago

I changed this. Unfortunately I could not use an automatic type validation by spring. In the e-Link endpoint I retrieved the value as string and then did the type check manually. I could not find a better solution. The solution is not very elegant but it works.

@pheyvaer please double check if the issue is solved and close the issue if it works now.