Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hnkfwhw opened this issue Nov 4, 2023 · 1 comment
Open

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

hnkfwhw opened this issue Nov 4, 2023 · 1 comment

Comments

@hnkfwhw
Copy link

hnkfwhw commented Nov 4, 2023

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();
			}
		};
	}
@hnkfwhw hnkfwhw 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 Nov 4, 2023
@Atom98-coding
Copy link

@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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants