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

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


The following commit(s) were added to refs/heads/param-sweep by this push:
     new 13d8f45  Fixing a possible NPE
13d8f45 is described below

commit 13d8f45926f272f05cacdbbdfcf2fda9bd901206
Author: Dimuthu Wannipurage <[email protected]>
AuthorDate: Mon Aug 24 15:50:44 2020 -0400

    Fixing a possible NPE
---
 .../api/service/handler/RegistryServerHandler.java | 25 ++++++++++++----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git 
a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
 
b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
index c69319e..af2d11e 100644
--- 
a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
+++ 
b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
@@ -732,20 +732,23 @@ public class RegistryServerHandler implements 
RegistryService.Iface {
     public List<OutputDataObjectType> getExperimentOutputsForJob(String 
airavataExperimentId, int jobIndex) throws RegistryServiceException, 
ExperimentNotFoundException, TException {
         List<OutputDataObjectType> experimentOutputs = 
getExperimentOutputs(airavataExperimentId);
         for (OutputDataObjectType out: experimentOutputs) {
-            String[] outValues = out.getValue().split(",");
-            List<String> filteredValues = new ArrayList<>();
-            for (String outDP : outValues) {
-                try {
-                    DataProductModel dataProduct = 
dataProductRepository.getDataProduct(outDP);
-                    Map<String, String> productMetadata = 
dataProduct.getProductMetadata();
-                    if (productMetadata.containsKey("version") && 
Integer.parseInt(productMetadata.get("version")) == jobIndex) {
-                        filteredValues.add(outDP);
+
+            if (out.getValue() != null) {
+                String[] outValues = out.getValue().split(",");
+                List<String> filteredValues = new ArrayList<>();
+                for (String outDP : outValues) {
+                    try {
+                        DataProductModel dataProduct = 
dataProductRepository.getDataProduct(outDP);
+                        Map<String, String> productMetadata = 
dataProduct.getProductMetadata();
+                        if (productMetadata.containsKey("version") && 
Integer.parseInt(productMetadata.get("version")) == jobIndex) {
+                            filteredValues.add(outDP);
+                        }
+                    } catch (ReplicaCatalogException e) {
+                        throw new RegistryServiceException("Failed to fetch 
data product with uri " + outDP);
                     }
-                } catch (ReplicaCatalogException e) {
-                    throw new RegistryServiceException("Failed to fetch data 
product with uri " + outDP);
                 }
+                out.setValue(String.join(",", filteredValues));
             }
-            out.setValue(String.join(",", filteredValues));
         }
         return experimentOutputs;
     }

Reply via email to