dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38521
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19628: minor simplification in @ExceptionHandlers in CrudControllerAdvice
------------------------------------------------------------
revno: 19628
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-07-13 15:56:14 +0700
message:
minor simplification in @ExceptionHandlers in CrudControllerAdvice
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CrudControllerAdvice.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CrudControllerAdvice.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CrudControllerAdvice.java 2015-07-10 17:25:59 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CrudControllerAdvice.java 2015-07-13 08:56:14 +0000
@@ -28,13 +28,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.beans.PropertyEditorSupport;
-import java.util.Date;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.validation.ConstraintViolationException;
-
import org.hisp.dhis.common.DeleteNotAllowedException;
import org.hisp.dhis.common.IllegalQueryException;
import org.hisp.dhis.common.MaintenanceModeException;
@@ -52,6 +45,12 @@
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.InitBinder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+import java.beans.PropertyEditorSupport;
+import java.util.Date;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -92,20 +91,8 @@
webMessageService.send( WebMessageUtils.unprocessableEntity( ex.getClass().getName() ), response, request );
}
- @ExceptionHandler( DeleteNotAllowedException.class )
- public void deleteNotAllowedExceptionHandler( DeleteNotAllowedException ex, HttpServletResponse response, HttpServletRequest request )
- {
- webMessageService.send( WebMessageUtils.conflict( ex.getMessage() ), response, request );
- }
-
- @ExceptionHandler( IllegalQueryException.class )
- public void illegalQueryExceptionHandler( IllegalQueryException ex, HttpServletResponse response, HttpServletRequest request )
- {
- webMessageService.send( WebMessageUtils.conflict( ex.getMessage() ), response, request );
- }
-
- @ExceptionHandler( IllegalArgumentException.class )
- public void illegalArgumentExceptionHandler( IllegalArgumentException ex, HttpServletResponse response, HttpServletRequest request )
+ @ExceptionHandler( { IllegalQueryException.class, IllegalArgumentException.class, DeleteNotAllowedException.class } )
+ public void conflictsExceptionHandler( Exception ex, HttpServletResponse response, HttpServletRequest request )
{
webMessageService.send( WebMessageUtils.conflict( ex.getMessage() ), response, request );
}