Handle exceptions.

This commit is contained in:
Paulo Gustavo Veiga 2013-03-24 16:20:56 -03:00
parent 4dd7a82e32
commit e36b0b8b52

View File

@ -131,23 +131,19 @@ public class AdminController extends BaseController {
@ResponseStatus(value = HttpStatus.NO_CONTENT) @ResponseStatus(value = HttpStatus.NO_CONTENT)
@RequestMapping(method = RequestMethod.GET, value = "admin/database/purge") @RequestMapping(method = RequestMethod.GET, value = "admin/database/purge")
public void purgeDB(@RequestParam(required = true) Integer muid, @RequestParam(required = true) Boolean apply) throws UnsupportedEncodingException, WiseMappingException { public void purgeDB(@RequestParam(required = true) Integer muid, @RequestParam(required = true) Boolean apply) {
for (int i = 0; i < muid; i++) { for (int i = 0; i < muid; i++) {
System.out.println("looking for user:" + i); System.out.println("Looking for user:" + i);
User user; User user = user = userService.getUserBy(i);
try {
user = userService.getUserBy(i);
} catch (DataAccessException e) {
// User does not exit's continue ...
continue;
}
if (user != null) {
// Do not process admin accounts ... // Do not process admin accounts ...
if (user.getEmail().contains("wisemapping")) { if (user.getEmail().contains("wisemapping")) {
continue; continue;
} }
try {
// Iterate over the list of maps ... // Iterate over the list of maps ...
final List<Collaboration> collaborations = mindmapService.findCollaborations(user); final List<Collaboration> collaborations = mindmapService.findCollaborations(user);
for (Collaboration collaboration : collaborations) { for (Collaboration collaboration : collaborations) {
@ -167,6 +163,14 @@ public class AdminController extends BaseController {
} }
} }
} }
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (WiseMappingException e) {
e.printStackTrace();
} catch (RuntimeException e) {
e.printStackTrace();
}
}
} }