{"action":"created","issue":{"url":"https://api.github.com/repos/moleculer-java/moleculer-java/issues/11","repository_url":"https://api.github.com/repos/moleculer-java/moleculer-java","labels_url":"https://api.github.com/repos/moleculer-java/moleculer-java/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/moleculer-java/moleculer-java/issues/11/comments","events_url":"https://api.github.com/repos/moleculer-java/moleculer-java/issues/11/events","html_url":"https://github.com/moleculer-java/moleculer-java/issues/11","id":378368345,"node_id":"MDU6SXNzdWUzNzgzNjgzNDU=","number":11,"title":"Can't return null from actions","user":{"login":"molobala","id":29891783,"node_id":"MDQ6VXNlcjI5ODkxNzgz","avatar_url":"https://avatars0.githubusercontent.com/u/29891783?v=4","gravatar_id":"","url":"https://api.github.com/users/molobala","html_url":"https://github.com/molobala","followers_url":"https://api.github.com/users/molobala/followers","following_url":"https://api.github.com/users/molobala/following{/other_user}","gists_url":"https://api.github.com/users/molobala/gists{/gist_id}","starred_url":"https://api.github.com/users/molobala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/molobala/subscriptions","organizations_url":"https://api.github.com/users/molobala/orgs","repos_url":"https://api.github.com/users/molobala/repos","events_url":"https://api.github.com/users/molobala/events{/privacy}","received_events_url":"https://api.github.com/users/molobala/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-07T16:33:06Z","updated_at":"2018-11-08T10:32:50Z","closed_at":null,"author_association":"NONE","body":"Impossible to return `null` from actions  \r\nIt gives `NullPointerException`  \r\n\r\n```\r\njava.util.concurrent.CompletionException: java.lang.NullPointerException\r\n\tat java.util.concurrent.CompletableFuture.encodeRelay(CompletableFuture.java:326) [na:1.8.0_191]\r\n\tat java.util.concurrent.CompletableFuture.completeRelay(CompletableFuture.java:338) [na:1.8.0_191]\r\n\tat java.util.concurrent.CompletableFuture.uniRelay(CompletableFuture.java:911) [na:1.8.0_191]\r\n\tat java.util.concurrent.CompletableFuture.uniCompose(CompletableFuture.java:953) [na:1.8.0_191]\r\n\tat java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:926) ~[na:1.8.0_191]\r\n\tat java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474) [na:1.8.0_191]\r\n\tat java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:1962) [na:1.8.0_191]\r\n\tat io.datatree.Promise.complete(Promise.java:682) ~[datatree-promise-1.0.3.jar:na]\r\n```"},"comment":{"url":"https://api.github.com/repos/moleculer-java/moleculer-java/issues/comments/436948544","html_url":"https://github.com/moleculer-java/moleculer-java/issues/11#issuecomment-436948544","issue_url":"https://api.github.com/repos/moleculer-java/moleculer-java/issues/11","id":436948544,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNjk0ODU0NA==","user":{"login":"molobala","id":29891783,"node_id":"MDQ6VXNlcjI5ODkxNzgz","avatar_url":"https://avatars0.githubusercontent.com/u/29891783?v=4","gravatar_id":"","url":"https://api.github.com/users/molobala","html_url":"https://github.com/molobala","followers_url":"https://api.github.com/users/molobala/followers","following_url":"https://api.github.com/users/molobala/following{/other_user}","gists_url":"https://api.github.com/users/molobala/gists{/gist_id}","starred_url":"https://api.github.com/users/molobala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/molobala/subscriptions","organizations_url":"https://api.github.com/users/molobala/orgs","repos_url":"https://api.github.com/users/molobala/repos","events_url":"https://api.github.com/users/molobala/events{/privacy}","received_events_url":"https://api.github.com/users/molobala/received_events","type":"User","site_admin":false},"created_at":"2018-11-08T10:32:50Z","updated_at":"2018-11-08T10:32:50Z","author_association":"NONE","body":"i got the problem.  \r\nIt was the fact I call `asObject` after `waitFor`being called on the action call like this \r\n\r\n```java\r\nthis.broker.call(\"user.getOne\", param).waitFor().asObject()\r\n```\r\nIn this case if the action returns null `asObject` fails\r\nSo I did like this, adding extra check\r\n```java\r\nTree ob = this.broker.call(\"user.getOne\", param).waitFor();\r\nUser user = ob==null ? null : (User) ob.asObject();\r\n\r\n```"}}
{"actor":{"display_login":"molobala"}}