@Test public void testExceptionHandlerConfigNull(){ Exception res = null; try { ActionExceptionHandler.handleError(null,new TestAction(),"a message"); } catch (IllegalArgumentException e){ return; } catch (Exception e) { fail(); } fail(); }
public static void handleError(ActionConfiguration conf, BaseAction owner, String msg) throws ActionException { if (conf == null) { if (LOGGER.isErrorEnabled()) { LOGGER.error(NULL_CONF_ERROR); } throw new IllegalArgumentException(NULL_CONF_ERROR); } final String ownerMsg = (owner == null) ? UNKNOWN_CLASS : owner.getClass().getName(); if (msg == null || msg.isEmpty()){ msg = UNKNOWN_MSG; } StringBuilder fullMsg = new StringBuilder(); fullMsg.append("Error in Class: ").append(ownerMsg).append(" - Message is: ") .append(msg); if (!conf.isFailIgnored()) { if (LOGGER.isErrorEnabled()) { LOGGER.error(fullMsg.toString()); } ActionException ex = new ActionException(owner, msg); if(owner != null){ Iterator iter = owner.getListeners().iterator(); while (iter.hasNext()) { Object el = iter.next(); if (el instanceof ProgressListenerForwarder) { ((ProgressListenerForwarder) el).failed(ex); } } } throw ex; } else { if (LOGGER.isWarnEnabled()) { LOGGER.warn(fullMsg.toString()); } } }
ActionExceptionHandler { public static void handleError(ActionConfiguration conf, BaseAction owner, String msg) throws ActionException { if (conf == null) { if (LOGGER.isErrorEnabled()) { LOGGER.error(NULL_CONF_ERROR); } throw new IllegalArgumentException(NULL_CONF_ERROR); } final String ownerMsg = (owner == null) ? UNKNOWN_CLASS : owner.getClass().getName(); if (msg == null || msg.isEmpty()){ msg = UNKNOWN_MSG; } StringBuilder fullMsg = new StringBuilder(); fullMsg.append("Error in Class: ").append(ownerMsg).append(" - Message is: ") .append(msg); if (!conf.isFailIgnored()) { if (LOGGER.isErrorEnabled()) { LOGGER.error(fullMsg.toString()); } ActionException ex = new ActionException(owner, msg); if(owner != null){ Iterator iter = owner.getListeners().iterator(); while (iter.hasNext()) { Object el = iter.next(); if (el instanceof ProgressListenerForwarder) { ((ProgressListenerForwarder) el).failed(ex); } } } throw ex; } else { if (LOGGER.isWarnEnabled()) { LOGGER.warn(fullMsg.toString()); } } } }
ActionExceptionHandler { public static void handleError(ActionConfiguration conf, BaseAction owner, String msg) throws ActionException { if (conf == null) { if (LOGGER.isErrorEnabled()) { LOGGER.error(NULL_CONF_ERROR); } throw new IllegalArgumentException(NULL_CONF_ERROR); } final String ownerMsg = (owner == null) ? UNKNOWN_CLASS : owner.getClass().getName(); if (msg == null || msg.isEmpty()){ msg = UNKNOWN_MSG; } StringBuilder fullMsg = new StringBuilder(); fullMsg.append("Error in Class: ").append(ownerMsg).append(" - Message is: ") .append(msg); if (!conf.isFailIgnored()) { if (LOGGER.isErrorEnabled()) { LOGGER.error(fullMsg.toString()); } ActionException ex = new ActionException(owner, msg); if(owner != null){ Iterator iter = owner.getListeners().iterator(); while (iter.hasNext()) { Object el = iter.next(); if (el instanceof ProgressListenerForwarder) { ((ProgressListenerForwarder) el).failed(ex); } } } throw ex; } else { if (LOGGER.isWarnEnabled()) { LOGGER.warn(fullMsg.toString()); } } }  }
ActionExceptionHandler { public static void handleError(ActionConfiguration conf, BaseAction owner, String msg) throws ActionException { if (conf == null) { if (LOGGER.isErrorEnabled()) { LOGGER.error(NULL_CONF_ERROR); } throw new IllegalArgumentException(NULL_CONF_ERROR); } final String ownerMsg = (owner == null) ? UNKNOWN_CLASS : owner.getClass().getName(); if (msg == null || msg.isEmpty()){ msg = UNKNOWN_MSG; } StringBuilder fullMsg = new StringBuilder(); fullMsg.append("Error in Class: ").append(ownerMsg).append(" - Message is: ") .append(msg); if (!conf.isFailIgnored()) { if (LOGGER.isErrorEnabled()) { LOGGER.error(fullMsg.toString()); } ActionException ex = new ActionException(owner, msg); if(owner != null){ Iterator iter = owner.getListeners().iterator(); while (iter.hasNext()) { Object el = iter.next(); if (el instanceof ProgressListenerForwarder) { ((ProgressListenerForwarder) el).failed(ex); } } } throw ex; } else { if (LOGGER.isWarnEnabled()) { LOGGER.warn(fullMsg.toString()); } } }  static void handleError(ActionConfiguration conf, BaseAction owner, String msg); }
ActionExceptionHandler { public static void handleError(ActionConfiguration conf, BaseAction owner, String msg) throws ActionException { if (conf == null) { if (LOGGER.isErrorEnabled()) { LOGGER.error(NULL_CONF_ERROR); } throw new IllegalArgumentException(NULL_CONF_ERROR); } final String ownerMsg = (owner == null) ? UNKNOWN_CLASS : owner.getClass().getName(); if (msg == null || msg.isEmpty()){ msg = UNKNOWN_MSG; } StringBuilder fullMsg = new StringBuilder(); fullMsg.append("Error in Class: ").append(ownerMsg).append(" - Message is: ") .append(msg); if (!conf.isFailIgnored()) { if (LOGGER.isErrorEnabled()) { LOGGER.error(fullMsg.toString()); } ActionException ex = new ActionException(owner, msg); if(owner != null){ Iterator iter = owner.getListeners().iterator(); while (iter.hasNext()) { Object el = iter.next(); if (el instanceof ProgressListenerForwarder) { ((ProgressListenerForwarder) el).failed(ex); } } } throw ex; } else { if (LOGGER.isWarnEnabled()) { LOGGER.warn(fullMsg.toString()); } } }  static void handleError(ActionConfiguration conf, BaseAction owner, String msg);  }