Skip to content

DefaultEngine will throw a NPE when a task throws a Error  #36

Description

@hnkfwhw
private Callable<ExecutionResult<T, R>> newCallable(final Task<T, R> task) {
		return new IdentifiableCallable<T, ExecutionResult<T,R>>() {

			@Override
			public ExecutionResult<T, R> call() throws Exception {
				R r = null;
				ExecutionResult<T, R> result = null;
				try {
					task.markStart();
                                        executionListener.onStart(task);
					r = task.execute();  // throw a Error
					result = ExecutionResult.success(task.getId(), r);
					state.removeErrored(result);
					task.markEnd();
					executionListener.onSuccess(task);
				} catch (Exception e) { //cannot catch Error 
					result = ExecutionResult.errored(task.getId(), r, e.getMessage());
					state.addErrored(result);
					task.markEnd();
					executionListener.onError(task, e);
					logger.error("Error Execution Task # {}", task.getId(), e);
				} finally {		
                                         // result is NULL			
					result.setTimes(task.getStartTime(), task.getEndTime());
				}
				return result;
			}

			@Override
			public T getIdentifier() {
				return task.getId();
			}
		};
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions