You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by di...@apache.org on 2018/04/26 18:56:08 UTC

[airavata] branch staging updated: Fixing NPE when creating an Optional from null object

This is an automated email from the ASF dual-hosted git repository.

dimuthuupe pushed a commit to branch staging
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/staging by this push:
     new 5f58b1b  Fixing NPE when creating an Optional from null object
5f58b1b is described below

commit 5f58b1b65ee71c13ef24a092d1a39c7c186cb76e
Author: dimuthu <di...@gmail.com>
AuthorDate: Thu Apr 26 14:55:56 2018 -0400

    Fixing NPE when creating an Optional from null object
---
 .../org/apache/airavata/helix/core/support/adaptor/AgentStore.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/support/adaptor/AgentStore.java b/modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/support/adaptor/AgentStore.java
index 61e575b..cd79cf0 100644
--- a/modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/support/adaptor/AgentStore.java
+++ b/modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/support/adaptor/AgentStore.java
@@ -45,7 +45,7 @@ public class AgentStore {
         if (protoToTokenMap != null) {
             Map<String, AgentAdaptor> tokenToAdaptorMap = protoToTokenMap.get(submissionProtocol);
             if (tokenToAdaptorMap != null) {
-                return Optional.of(tokenToAdaptorMap.get(authToken));
+                return Optional.ofNullable(tokenToAdaptorMap.get(authToken));
             } else {
                 return Optional.empty();
             }
@@ -65,7 +65,7 @@ public class AgentStore {
         if (protoToTokenMap != null) {
             Map<String, StorageResourceAdaptor> tokenToAdaptorMap = protoToTokenMap.get(dataMovementProtocol);
             if (tokenToAdaptorMap != null) {
-                return Optional.of(tokenToAdaptorMap.get(authToken));
+                return Optional.ofNullable(tokenToAdaptorMap.get(authToken));
             } else {
                 return Optional.empty();
             }

-- 
To stop receiving notification emails like this one, please contact
dimuthuupe@apache.org.