Roberto Sánchez
2014-01-21 b83a0ba903b56562751963c106b4c20352c26087
securis/src/main/java/net/curisit/securis/services/ApplicationResource.java
....@@ -23,7 +23,7 @@
2323 import javax.ws.rs.core.Response.Status;
2424
2525 import net.curisit.integrity.commons.Utils;
26
-import net.curisit.securis.SecurisErrorHandler;
26
+import net.curisit.securis.DefaultExceptionHandler;
2727 import net.curisit.securis.db.Application;
2828 import net.curisit.securis.utils.TokenHelper;
2929
....@@ -88,7 +88,8 @@
8888 Application app = em.find(Application.class, Integer.parseInt(appid));
8989 if (app == null) {
9090 log.error("Application with id {} not found in DB", appid);
91
- return Response.status(Status.NOT_FOUND).header(SecurisErrorHandler.HEADER_ERROR_MESSAGE, "Application not found with ID: " + appid).build();
91
+
92
+ return Response.status(Status.NOT_FOUND).header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, "Application not found with ID: " + appid).build();
9293 }
9394 return Response.ok(app).build();
9495 }
....@@ -121,7 +122,7 @@
121122 Application currentapp = em.find(Application.class, Integer.parseInt(appid));
122123 if (currentapp == null) {
123124 log.error("Application with id {} not found in DB", appid);
124
- return Response.status(Status.NOT_FOUND).header(SecurisErrorHandler.HEADER_ERROR_MESSAGE, "Application not found with ID: " + appid).build();
125
+ return Response.status(Status.NOT_FOUND).header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, "Application not found with ID: " + appid).build();
125126 }
126127 currentapp.setName(app.getName());
127128 currentapp.setDescription(app.getDescription());
....@@ -141,11 +142,11 @@
141142 Application app = em.find(Application.class, Integer.parseInt(appid));
142143 if (app == null) {
143144 log.error("Application with id {} can not be deleted, It was not found in DB", appid);
144
- return Response.status(Status.NOT_FOUND).header(SecurisErrorHandler.HEADER_ERROR_MESSAGE, "Application not found with ID: " + appid).build();
145
+ return Response.status(Status.NOT_FOUND).header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, "Application not found with ID: " + appid).build();
145146 }
146147
147148 if (app.getLicenseTypes() != null && app.getLicenseTypes().size() > 0) {
148
- return Response.status(Status.FORBIDDEN).header(SecurisErrorHandler.HEADER_ERROR_MESSAGE, "Application can not be deleted becasue has assigned one or more License types, ID: " + appid).build();
149
+ return Response.status(Status.FORBIDDEN).header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, "Application can not be deleted becasue has assigned one or more License types, ID: " + appid).build();
149150 }
150151
151152 em.remove(app);