@ExceptionHandler(NotFoundServiceEx.class) public void ruleNotFound( NotFoundServiceEx exception, HttpServletRequest request, HttpServletResponse response) throws IOException { response.sendError(404, exception.getMessage()); }
@ExceptionHandler(NotFoundServiceEx.class) public void ruleNotFound( NotFoundServiceEx exception, HttpServletRequest request, HttpServletResponse response) throws IOException { response.sendError(404, exception.getMessage()); }
TYPE get(Long oldId) throws RemapperException, NotFoundRestEx { Long newId = idRemapper.get(oldId); if ( newId == null ) { LOGGER.error("Can't remap " + oldId); throw new RemapperException("Can't remap " + oldId); } TYPE cached = cache.get(newId); try { if ( cached == null ) { cached = service.get(newId.longValue()); // may throw NotFoundServiceEx cache.put(newId, cached); } return cached; } catch (NotFoundServiceEx ex) { LOGGER.error(ex.getMessage(), ex); throw new NotFoundRestEx(ex.getMessage()); } } }
throw e; } catch (NotFoundServiceEx e) { LOGGER.warn(e.getMessage()); throw new NotFoundRestEx(e.getMessage()); } catch (Exception e) { LOGGER.warn("Unexpected exception", e);
logger.error(e.getMessage(), e); throw new ApplicationException(e.getMessage(), e);
logger.error(e.getMessage(), e); throw new ApplicationException(e.getMessage(), e);
@Override public void update(String name, RESTInputGroup group) throws BadRequestRestEx, NotFoundRestEx, InternalErrorRestEx { try { UserGroup old = userGroupAdminService.get(name); ShortGroup newGroup = new ShortGroup(); newGroup.setId(old.getId()); if ( (group.getExtId() != null) ) { throw new BadRequestRestEx("ExtId can't be updated"); } if ( (group.getName() != null) ) { throw new BadRequestRestEx("Name can't be updated"); } if ( group.isEnabled() != null ) { newGroup.setEnabled(group.isEnabled()); } userGroupAdminService.update(newGroup); } catch (GeoFenceRestEx ex) { // already handled throw ex; } catch (NotFoundServiceEx ex) { LOGGER.warn("Role not found: " + name + ": " + ex.getMessage(), ex); throw new NotFoundRestEx(ex.getMessage()); } catch (BadRequestServiceEx ex) { LOGGER.warn("Problems updating role:" + name + ": " + ex.getMessage(), ex); throw new BadRequestRestEx(ex.getMessage()); } catch (Exception ex) { LOGGER.error(ex); throw new InternalErrorRestEx(ex.getMessage()); } }
LOGGER.warn("Problems inserting user: " + ex.getMessage(), ex); throw new NotFoundRestEx(ex.getMessage()); } catch (BadRequestServiceEx ex) { LOGGER.warn("Problems inserting user: " + ex.getMessage(), ex);
LOGGER.warn("AdminRule not found id: " + id + ": " + ex.getMessage(), ex); throw new NotFoundRestEx(ex.getMessage()); } catch (BadRequestServiceEx ex) { LOGGER.warn("Problems updating AdminRule id:" + id + ": " + ex.getMessage(), ex);
public void saveAllRules(List<RuleModel> rules) throws ApplicationException { for (ShortRule rule : geofenceRemoteService.getRuleAdminService() .getAll()) { try { geofenceRemoteService.getRuleAdminService() .delete(rule.getId()); } catch (NotFoundServiceEx e) { logger.error(e.getMessage(), e); throw new ApplicationException(e.getMessage(), e); } } for (RuleModel localRule : rules) { IPAddressRange addressRange = validateSourceRange(localRule.getSourceIPRange()); Rule rule = new Rule( localRule.getPriority(), "*".equals(localRule.getUsername()) ? null : localRule.getUsername(), "*".equals(localRule.getRolename()) ? null : localRule.getRolename(), getInstance(localRule.getInstance()), addressRange, "*".equals(localRule.getService()) ? null : localRule.getService(), "*".equals(localRule.getRequest()) ? null : localRule.getRequest(), "*".equals(localRule.getWorkspace()) ? null : localRule.getWorkspace(), "*".equals(localRule.getLayer()) ? null : localRule.getLayer(), getAccessType(localRule.getGrant())); geofenceRemoteService.getRuleAdminService().insert(rule); } }
logger.error(e.getMessage(), e); throw new ApplicationException(e.getMessage(), e);
LOGGER.warn("GSInstance not found id: " + id + ": " + ex.getMessage(), ex); throw new NotFoundRestEx(ex.getMessage()); } catch (BadRequestServiceEx ex) { LOGGER.warn("Problems updating GSInstance id:" + id + ": " + ex.getMessage(), ex);
LOGGER.warn("Problems updating user " + id + ": " + ex.getMessage(), ex); throw new NotFoundRestEx(ex.getMessage()); } catch (BadRequestServiceEx ex) { LOGGER.warn("Problems updating user " + id + ": " + ex.getMessage(), ex);
logger.error(e.getMessage(), e); throw new ApplicationException(e.getMessage(), e); } catch (ParseException e) { logger.error(e.getMessage(), e);
logger.error(e.getMessage(), e); throw new ApplicationException(e.getMessage(), e); } catch (MalformedURLException e) { logger.error(e.getMessage(), e);
LOGGER.warn("Rule not found id: " + id + ": " + ex.getMessage(), ex); throw new NotFoundRestEx(ex.getMessage()); } catch (BadRequestServiceEx ex) { LOGGER.warn("Problems updating rule id:" + id + ": " + ex.getMessage(), ex);
logger.error(e.getMessage(), e); throw new ApplicationException(e.getMessage(), e);