You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2017/09/02 15:35:25 UTC

[05/50] [abbrv] oodt git commit: safe guard in cases where there are no topN products coming back

safe guard in cases where there are no topN products coming back

Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/3d0a241f
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/3d0a241f
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/3d0a241f

Branch: refs/heads/development
Commit: 3d0a241f14bda572ed3c63b68fb625a7f85d99e2
Parents: 7616e00
Author: Chris Mattmann <ma...@apache.org>
Authored: Thu Jul 20 22:30:23 2017 -0700
Committer: Chris Mattmann <ma...@apache.org>
Committed: Thu Jul 20 22:30:23 2017 -0700

----------------------------------------------------------------------
 .../apache/oodt/pcs/services/HealthResource.java  | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oodt/blob/3d0a241f/pcs/services/src/main/java/org/apache/oodt/pcs/services/HealthResource.java
----------------------------------------------------------------------
diff --git a/pcs/services/src/main/java/org/apache/oodt/pcs/services/HealthResource.java b/pcs/services/src/main/java/org/apache/oodt/pcs/services/HealthResource.java
index b2d9b8d..80eadfb 100644
--- a/pcs/services/src/main/java/org/apache/oodt/pcs/services/HealthResource.java
+++ b/pcs/services/src/main/java/org/apache/oodt/pcs/services/HealthResource.java
@@ -299,13 +299,17 @@ public class HealthResource extends PCSService {
     Map<String, Object> latestFilesOutput = new ConcurrentHashMap<String, Object>();
     latestFilesOutput.put("topN", PCSHealthMonitor.TOP_N_PRODUCTS);
     List<Object> latestFilesList = new Vector<Object>();
-    for (Product prod : (List<Product>) (List<?>) report
-        .getLatestProductsIngested()) {
-      try {
-        this.encodeLatestFile(latestFilesList, prod);
-      } catch (MalformedURLException e) {
-        LOG.log(Level.WARNING, "Unable to encode latest file: ["
-            + prod.getProductName() + "]: error: Message: " + e.getMessage());
+    if (report != null && 
+        report.getLatestProductsIngested() != null && 
+        report.getLatestProductsIngested().size() > 0){
+      for (Product prod : (List<Product>) (List<?>) report
+          .getLatestProductsIngested()) {
+        try {
+          this.encodeLatestFile(latestFilesList, prod);
+        } catch (MalformedURLException e) {
+          LOG.log(Level.WARNING, "Unable to encode latest file: ["
+              + prod.getProductName() + "]: error: Message: " + e.getMessage());
+        }
       }
     }
     latestFilesOutput.put("files", latestFilesList);