linkedin/parseq

Improve exception when function passed to one of Task's API that is supposed to return Task returns null

Closed this issue · 1 comments

For example:

Task.value(10).flatMap(x -> null);

Above task is resolved with the following failure that does not explain what the problem was:

java.lang.NullPointerException
	at com.linkedin.parseq.promise.Promises.propagateResult(Promises.java:86)
	at com.linkedin.parseq.promise.Promises.propagateResult(Promises.java:90)
	at com.linkedin.parseq.Task.lambda$22(Task.java:825)
	at com.linkedin.parseq.BaseTask$WrappedContext$WrappedAfter.lambda$0(BaseTask.java:528)
	at com.linkedin.parseq.internal.ContextImpl$4$2.onResolved(ContextImpl.java:164)
	at com.linkedin.parseq.promise.SettablePromiseImpl.notifyListener(SettablePromiseImpl.java:148)
	at com.linkedin.parseq.promise.SettablePromiseImpl.notifyListeners(SettablePromiseImpl.java:136)
	at com.linkedin.parseq.promise.SettablePromiseImpl.lambda$0(SettablePromiseImpl.java:117)
	at com.linkedin.parseq.internal.Continuations$Continuation.loop(Continuations.java:78)
	at com.linkedin.parseq.internal.Continuations$Continuation.submit(Continuations.java:62)
	at com.linkedin.parseq.internal.Continuations$Continuation.access$1(Continuations.java:56)
	at com.linkedin.parseq.internal.Continuations.submit(Continuations.java:41)
	at com.linkedin.parseq.promise.SettablePromiseImpl.doFinish(SettablePromiseImpl.java:117)
	at com.linkedin.parseq.promise.SettablePromiseImpl.done(SettablePromiseImpl.java:51)
	at com.linkedin.parseq.BaseTask.done(BaseTask.java:294)
	at com.linkedin.parseq.BaseTask.lambda$0(BaseTask.java:187)
	at com.linkedin.parseq.promise.SettablePromiseImpl.notifyListener(SettablePromiseImpl.java:148)
	at com.linkedin.parseq.promise.SettablePromiseImpl.addListener(SettablePromiseImpl.java:102)
	at com.linkedin.parseq.BaseTask.contextRun(BaseTask.java:183)
	at com.linkedin.parseq.internal.ContextImpl$2.run(ContextImpl.java:93)
	at com.linkedin.parseq.internal.SerialExecutor$ExecutorLoop.run(SerialExecutor.java:121)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Fixed in 2.6.15.