Skip to content

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

Open

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();
			}
		};
	}

Activity

  1. changed the title [-]DefaultEngine will throw a NPE when a task thows a Error [/-] [+]DefaultEngine will throw a NPE when a task throws a Error [/+] on Nov 4, 2023
  2. Atom98-coding commented on Jan 29, 2024

    @Atom98-coding

    @mnadeem sir, can you please fix this bug. this could lead to a situation error cant be throwed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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