Repository: falcon
Updated Branches:
  refs/heads/master 8be383ebe -> 4591ffb61


FALCON-1641 Triage on an invalid feed instance throws IndexOutOfBoundException. 
Contributed by Karishma Gulati.


Project: http://git-wip-us.apache.org/repos/asf/falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/47f8a605
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/47f8a605
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/47f8a605

Branch: refs/heads/master
Commit: 47f8a605df3c2fe98d4690838491479b17f1fb40
Parents: 15e43a8
Author: Ajay Yadava <[email protected]>
Authored: Tue Dec 15 16:59:26 2015 +0530
Committer: Ajay Yadava <[email protected]>
Committed: Tue Dec 15 17:53:16 2015 +0530

----------------------------------------------------------------------
 CHANGES.txt                                       |  2 ++
 .../falcon/resource/AbstractInstanceManager.java  | 18 +++++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/47f8a605/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index bf3e47f..4c2e42c 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -72,6 +72,8 @@ Trunk (Unreleased)
   OPTIMIZATIONS
 
   BUG FIXES
+    FALCON-1641 Triage on an invalid feed instance throws 
IndexOutOfBoundException(Karishma Gulati via Ajay Yadava)
+
     FALCON-1572 Only one instance is running in a process when run using 
Native Scheduler(Pallavi Rao via Ajay Yadava)
 
     FALCON-1660 Examples directory missing in distributed mode(Praveen Adlakha 
via Ajay Yadava)

http://git-wip-us.apache.org/repos/asf/falcon/blob/47f8a605/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
----------------------------------------------------------------------
diff --git 
a/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java 
b/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
index 81960a0..da2fea7 100644
--- 
a/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
+++ 
b/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
@@ -313,7 +313,7 @@ public abstract class AbstractInstanceManager extends 
AbstractEntityManager {
         // Sort the ArrayList using orderBy
         instanceSet = sortInstances(instanceSet, orderBy.toLowerCase(), 
sortOrder);
         result.setCollection(instanceSet.subList(
-                offset, (offset+pageCount)).toArray(new Instance[pageCount]));
+                offset, (offset + pageCount)).toArray(new 
Instance[pageCount]));
         return result;
     }
 
@@ -706,9 +706,13 @@ public abstract class AbstractInstanceManager extends 
AbstractEntityManager {
 
                 // add vertex to the graph
                 vertices.add(currentInstance.toString());
-                instanceStatusMap.put(currentInstance.toString(), "[" + 
status.name() + "]");
-                if (status == FeedInstanceStatus.AvailabilityStatus.AVAILABLE) 
{
-                    continue;
+                if (status == null) {
+                    instanceStatusMap.put(currentInstance.toString(), "[ Not 
Available ]");
+                } else {
+                    instanceStatusMap.put(currentInstance.toString(), "[" + 
status.name() + "]");
+                    if (status == 
FeedInstanceStatus.AvailabilityStatus.AVAILABLE) {
+                        continue;
+                    }
                 }
 
                 // find producer process instance and add it to the queue
@@ -782,7 +786,11 @@ public abstract class AbstractInstanceManager extends 
AbstractEntityManager {
         Date endRange = new Date(instanceTime.getTime() + 200);
         List<FeedInstanceStatus> feedListing = storage.getListing(feed, 
cluster.getName(), LocationType.DATA,
                 instanceTime, endRange);
-        return feedListing.get(0).getStatus();
+        if (feedListing.size() > 0) {
+            return feedListing.get(0).getStatus();
+        }
+        LOG.warn("No instances were found for the given feed: {} & 
instanceTime: {}", feed, instanceTime);
+        return null;
     }
 
     private InstancesResult.WorkflowStatus getProcessInstanceStatus(Process 
process, Date instanceTime)

Reply via email to