Use exceptions instead of checking for null to send correct http code
If a session was not found in database this will result in http 404, if the session is not accessable for the current user the request will result in http 403. The old behavior was to check for null. This was the response if the session was not found or the current user could not access this session (not owner and inactive sessions). Both ended up with http 404 - not found.
Showing
- src/main/java/de/thm/arsnova/SessionController.java 10 additions, 4 deletionssrc/main/java/de/thm/arsnova/SessionController.java
- src/main/java/de/thm/arsnova/dao/CouchDBDao.java 4 additions, 2 deletionssrc/main/java/de/thm/arsnova/dao/CouchDBDao.java
- src/main/java/de/thm/arsnova/exceptions/ForbiddenException.java 5 additions, 0 deletions...in/java/de/thm/arsnova/exceptions/ForbiddenException.java
- src/main/java/de/thm/arsnova/exceptions/NotFoundException.java 5 additions, 0 deletions...ain/java/de/thm/arsnova/exceptions/NotFoundException.java
- src/test/java/de/thm/arsnova/controller/SessionControllerTest.java 20 additions, 4 deletions...java/de/thm/arsnova/controller/SessionControllerTest.java
- src/test/java/de/thm/arsnova/dao/StubDatabaseDao.java 18 additions, 1 deletionsrc/test/java/de/thm/arsnova/dao/StubDatabaseDao.java
Please register or sign in to comment