protected void handleException(Throwable cause, Map<String, Object> handlerInfoMap) { if (handlingProcessId != null && handlingStrategy != null) { throw new ProcessWorkItemHandlerException(handlingProcessId, handlingStrategy, cause); } String service = (String) handlerInfoMap.get("Interface"); String operation = (String) handlerInfoMap.get("Operation"); if (this.logThrownException) { String message; if (service != null) { message = this.getClass().getSimpleName() + " failed when calling " + service + "." + operation; } else { message = this.getClass().getSimpleName() + " failed while trying to complete the task."; } logger.error(message, cause); } else { WorkItemHandlerRuntimeException wihRe = new WorkItemHandlerRuntimeException(cause); for (String key : handlerInfoMap.keySet()) { wihRe.setInformation(key, handlerInfoMap.get(key)); } wihRe.setInformation(WorkItemHandlerRuntimeException.WORKITEMHANDLERTYPE, this.getClass().getSimpleName()); throw wihRe; } }
private void handleException(Throwable cause, String service, String interfaceImplementationRef, String operation, String paramType, Object param) { logger.debug("Handling exception {} inside service {} or {} and operation {} with param type {} and value {}", cause.getMessage(), service, operation, paramType, param); WorkItemHandlerRuntimeException wihRe; if( cause instanceof InvocationTargetException ) { Throwable realCause = cause.getCause(); wihRe = new WorkItemHandlerRuntimeException(realCause); wihRe.setStackTrace(realCause.getStackTrace()); } else { wihRe = new WorkItemHandlerRuntimeException(cause); wihRe.setStackTrace(cause.getStackTrace()); } wihRe.setInformation("Interface", service); wihRe.setInformation("InterfaceImplementationRef", interfaceImplementationRef); wihRe.setInformation("Operation", operation); wihRe.setInformation("ParameterType", paramType); wihRe.setInformation("Parameter", param); wihRe.setInformation(WorkItemHandlerRuntimeException.WORKITEMHANDLERTYPE, this.getClass().getSimpleName()); throw wihRe; }
@Override public void handleExecuteException(Throwable cause, WorkItem workItem, WorkItemManager manager) { if( getAndIncreaseExceptionCount(workItem.getProcessInstanceId()) < exceptionCountLimit ) { workItem.getParameters().put(this.workItemExceptionParameterName, cause); ((org.drools.core.process.instance.WorkItemManager) manager).signalEvent(this.eventType, (org.drools.core.process.instance.WorkItem) workItem, workItem.getProcessInstanceId()); } else { if( cause instanceof RuntimeException ) { throw (RuntimeException) cause; } else { throw new WorkItemHandlerRuntimeException(cause, "Signalling process instance " + workItem.getProcessInstanceId() + " with '" + this.eventType + "' resulted this exception."); } } }
protected void handleException(Throwable cause, Map<String, Object> handlerInfoMap) { String service = (String) handlerInfoMap.get("Interface"); String operation = (String) handlerInfoMap.get("Operation"); if (this.logThrownException) { String message; if( service != null ) { message = this.getClass().getSimpleName() + " failed when calling " + service + "." + operation; } else { message = this.getClass().getSimpleName() + " failed while trying to complete the task."; } logger.error(message, cause); } else { WorkItemHandlerRuntimeException wihRe = new WorkItemHandlerRuntimeException(cause); for( String key : handlerInfoMap.keySet() ) { wihRe.setInformation(key, handlerInfoMap.get(key) ); } wihRe.setInformation(WorkItemHandlerRuntimeException.WORKITEMHANDLERTYPE, this.getClass().getSimpleName()); throw wihRe; } }
protected void handleException(Throwable cause, Map<String, Object> handlerInfoMap) { if (handlingProcessId != null && handlingStrategy != null) { throw new ProcessWorkItemHandlerException(handlingProcessId, handlingStrategy, cause); } String service = (String) handlerInfoMap.get("Interface"); String operation = (String) handlerInfoMap.get("Operation"); if (this.logThrownException) { String message; if (service != null) { message = this.getClass().getSimpleName() + " failed when calling " + service + "." + operation; } else { message = this.getClass().getSimpleName() + " failed while trying to complete the task."; } logger.error(message, cause); } else { WorkItemHandlerRuntimeException wihRe = new WorkItemHandlerRuntimeException(cause); for (String key : handlerInfoMap.keySet()) { wihRe.setInformation(key, handlerInfoMap.get(key)); } wihRe.setInformation(WorkItemHandlerRuntimeException.WORKITEMHANDLERTYPE, this.getClass().getSimpleName()); throw wihRe; } }
private void handleException(Throwable cause, String service, String interfaceImplementationRef, String operation, String paramType, Object param) { logger.debug("Handling exception {} inside service {} or {} and operation {} with param type {} and value {}", cause.getMessage(), service, operation, paramType, param); WorkItemHandlerRuntimeException wihRe; if( cause instanceof InvocationTargetException ) { Throwable realCause = cause.getCause(); wihRe = new WorkItemHandlerRuntimeException(realCause); wihRe.setStackTrace(realCause.getStackTrace()); } else { wihRe = new WorkItemHandlerRuntimeException(cause); wihRe.setStackTrace(cause.getStackTrace()); } wihRe.setInformation("Interface", service); wihRe.setInformation("InterfaceImplementationRef", interfaceImplementationRef); wihRe.setInformation("Operation", operation); wihRe.setInformation("ParameterType", paramType); wihRe.setInformation("Parameter", param); wihRe.setInformation(WorkItemHandlerRuntimeException.WORKITEMHANDLERTYPE, this.getClass().getSimpleName()); throw wihRe; }
@Override public void handleExecuteException(Throwable cause, WorkItem workItem, WorkItemManager manager) { if( getAndIncreaseExceptionCount(workItem.getProcessInstanceId()) < exceptionCountLimit ) { workItem.getParameters().put(this.workItemExceptionParameterName, cause); ((org.drools.core.process.instance.WorkItemManager) manager).signalEvent(this.eventType, (org.drools.core.process.instance.WorkItem) workItem, workItem.getProcessInstanceId()); } else { if( cause instanceof RuntimeException ) { throw (RuntimeException) cause; } else { throw new WorkItemHandlerRuntimeException(cause, "Signalling process instance " + workItem.getProcessInstanceId() + " with '" + this.eventType + "' resulted this exception."); } } }
cause.fillInStackTrace(); WorkItemHandlerRuntimeException wihre = new WorkItemHandlerRuntimeException(cause, fmsg); wihre.setStackTrace(cause.getStackTrace()); wihre.setInformation(SERVICE_NAME, serviceName != null ? serviceName.toString() : null);
cause.fillInStackTrace(); WorkItemHandlerRuntimeException wihre = new WorkItemHandlerRuntimeException(cause, fmsg); wihre.setStackTrace(cause.getStackTrace()); wihre.setInformation(SERVICE_NAME, serviceName != null ? serviceName.toString() : null);