Repository: zeppelin
Updated Branches:
  refs/heads/master 7ccfdf705 -> 5bc99f9aa


[MINOR] Prevent log NPE in ResourcePoolUtils.getAllResourcesExcept()

### What is this PR for?

ResourcePoolUtils.getAllResourcesExcept() sometimes throws NPE. Which doesn't 
really need to be logged.

```
ResourcePoolUtils.java[getAllResourcesExcept]:64) -
java.lang.NullPointerException
        at 
org.apache.zeppelin.resource.ResourcePoolUtils.getAllResourcesExcept(ResourcePoolUtils.java:58)
        at 
org.apache.zeppelin.resource.ResourcePoolUtils.getAllResources(ResourcePoolUtils.java:36)
        at org.apache.zeppelin.helium.Helium.suggestApp(Helium.java:264)
        at org.apache.zeppelin.rest.HeliumRestApi.suggest(HeliumRestApi.java:84)
```

### What type of PR is it?
Improvement

### Todos
* [x] - handle null thrift client

### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no

Author: Lee moon soo <[email protected]>

Closes #1958 from Leemoonsoo/npe_getallresources and squashes the following 
commits:

862d86f [Lee moon soo] prevent logging NPE in 
ResourcePoolUtils.getAllResourcesExcept()


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/5bc99f9a
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/5bc99f9a
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/5bc99f9a

Branch: refs/heads/master
Commit: 5bc99f9aa3c575716d102ec41356d57bc5195843
Parents: 7ccfdf7
Author: Lee moon soo <[email protected]>
Authored: Mon Jan 30 06:31:18 2017 +0900
Committer: Lee moon soo <[email protected]>
Committed: Wed Feb 1 05:53:48 2017 +0900

----------------------------------------------------------------------
 .../java/org/apache/zeppelin/resource/ResourcePoolUtils.java     | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/5bc99f9a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourcePoolUtils.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourcePoolUtils.java
 
b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourcePoolUtils.java
index 9878d7e..1a7f606 100644
--- 
a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourcePoolUtils.java
+++ 
b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourcePoolUtils.java
@@ -55,6 +55,10 @@ public class ResourcePoolUtils {
         boolean broken = false;
         try {
           client = remoteInterpreterProcess.getClient();
+          if (client == null) {
+            // remote interpreter may not started yet or terminated.
+            continue;
+          }
           List<String> resourceList = client.resourcePoolGetAll();
           Gson gson = new Gson();
           for (String res : resourceList) {

Reply via email to