You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@falcon.apache.org by aj...@apache.org on 2016/01/20 18:01:54 UTC

falcon git commit: FALCON-1748 Client throws FalconWebException irrespective of type of error. Contributed by Praveen Adlakha.

Repository: falcon
Updated Branches:
  refs/heads/0.9 cc41b2070 -> ae002a01e


FALCON-1748 Client throws FalconWebException irrespective of type of error. Contributed by Praveen Adlakha.


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

Branch: refs/heads/0.9
Commit: ae002a01ee517753680180bbec2feb599edcf2a3
Parents: cc41b20
Author: Ajay Yadava <aj...@gmail.com>
Authored: Wed Jan 20 22:30:01 2016 +0530
Committer: Ajay Yadava <aj...@gmail.com>
Committed: Wed Jan 20 22:30:01 2016 +0530

----------------------------------------------------------------------
 CHANGES.txt                                     | 17 +---
 .../falcon/client/FalconCLIException.java       | 51 +-----------
 .../org/apache/falcon/client/FalconClient.java  | 21 +----
 .../org/apache/falcon/FalconWebException.java   |  5 +-
 .../resource/AbstractInstanceManager.java       |  2 +-
 .../AbstractSchedulableEntityManager.java       | 17 ++--
 .../proxy/SchedulableEntityManagerProxy.java    |  9 +-
 .../falcon/resource/ConfigSyncService.java      | 19 ++++-
 .../apache/falcon/resource/InstanceManager.java | 87 ++++++++++++++++----
 .../resource/SchedulableEntityManager.java      | 79 ++++++++++++++----
 10 files changed, 179 insertions(+), 128 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/ae002a01/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6e54dc1..765569e 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,16 +1,5 @@
 Apache Falcon Change log
-Trunk
-  TASKS:
-  INCOMPATIBLE CHANGES
-  NEW FEATURES
-    FALCON-1495 In instance status list, show all runs for instances when requested by user(Narayan Periwal via Ajay Yadava)
-
-    FALCON-1230 Data based notification Service to notify execution instances when data becomes available(Pavan Kumar Kolamuri via Ajay Yadava)
-  IMPROVEMENTS
-  BUG FIXES
-
-
-Proposed Release Version: 0.9
+Release Version: 0.9
     FALCON-1718 Change version in pom.xml(Pallavi Rao via Ajay Yadava)
 
     FALCON-1594 Update changes.txt to reflect 0.8 as released version(Sowmya Ramesh via Ajay Yadava)
@@ -43,7 +32,7 @@ Proposed Release Version: 0.9
     FALCON-1233 Support co-existence of Oozie scheduler (coord) and Falcon native scheduler (Pallavi Rao)
 
     FALCON-1596 Spring shell based CLI for Falcon
-	FALCON-1608 Base framework for Spring Shell based shell for Falcon (Rajat Khandelwal via Ajay Yadava)
+	    FALCON-1608 Base framework for Spring Shell based shell for Falcon (Rajat Khandelwal via Ajay Yadava)
  
     FALCON-1234 State Store for instances scheduled by Falcon (Pavan Kolamuri via Pallavi Rao)
     
@@ -117,6 +106,8 @@ Proposed Release Version: 0.9
   OPTIMIZATIONS
 
   BUG FIXES
+    FALCON-1748 Client throws FalconWebException irrespective of type of error(Praveen Adlakha via Ajay Yadava)
+
     FALCON-1727 Suspend fails with InvalidStateTransitionException if entity has 'KILLED' instances (Pallavi Rao)
 
     FALCON-1723 Rerun with skip fail actions won't work in few cases (Pavan Kolamuri via Pallavi Rao)

http://git-wip-us.apache.org/repos/asf/falcon/blob/ae002a01/client/src/main/java/org/apache/falcon/client/FalconCLIException.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/client/FalconCLIException.java b/client/src/main/java/org/apache/falcon/client/FalconCLIException.java
index e7dfa52..29efbae 100644
--- a/client/src/main/java/org/apache/falcon/client/FalconCLIException.java
+++ b/client/src/main/java/org/apache/falcon/client/FalconCLIException.java
@@ -20,7 +20,6 @@ package org.apache.falcon.client;
 
 import com.sun.jersey.api.client.ClientResponse;
 import org.apache.falcon.resource.APIResult;
-import org.apache.falcon.resource.InstancesResult;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -45,10 +44,6 @@ public class FalconCLIException extends Exception {
     }
 
     public static FalconCLIException fromReponse(ClientResponse clientResponse) {
-        return new FalconCLIException(getMessage(clientResponse));
-    }
-
-    private static String getMessage(ClientResponse clientResponse) {
         ClientResponse.Status status = clientResponse.getClientResponseStatus();
         String statusValue = status.toString();
         String message = "";
@@ -57,13 +52,8 @@ public class FalconCLIException extends Exception {
             InputStream in = clientResponse.getEntityInputStream();
             try {
                 in.mark(MB);
-                try {
-                    message = clientResponse.getEntity(APIResult.class).getMessage();
-                } catch (Throwable e) {
-                    in.reset();
-                    message = clientResponse.getEntity(InstancesResult.class).getMessage();
-                }
-            } catch (Throwable t) {
+                message = clientResponse.getEntity(APIResult.class).getMessage();
+            } catch (Throwable th) {
                 byte[] data = new byte[MB];
                 try {
                     in.reset();
@@ -74,41 +64,6 @@ public class FalconCLIException extends Exception {
                 }
             }
         }
-        return statusValue + ";" + message;
-    }
-
-    public static FalconCLIException fromReponse(ClientResponse clientResponse, Class<? extends APIResult> clazz) {
-        return new FalconCLIException(getMessage(clientResponse, clazz));
-    }
-
-    private static  String getMessage(ClientResponse clientResponse, Class<? extends APIResult> clazz) {
-        ClientResponse.Status status = clientResponse.getClientResponseStatus();
-        String statusValue = status.toString();
-        String message = "";
-        if (status == ClientResponse.Status.BAD_REQUEST) {
-            clientResponse.bufferEntity();
-            InputStream in = clientResponse.getEntityInputStream();
-            try {
-                in.mark(MB);
-                message = clientResponse.getEntity(clazz).getMessage();
-            } catch (Throwable th) {
-                try {
-                    in.reset();
-                    message = clientResponse.getEntity(APIResult.class).getMessage();
-                } catch (Throwable t) {
-                    byte[] data = new byte[MB];
-                    try {
-                        in.reset();
-                        int len = in.read(data);
-                        message = new String(data, 0, len);
-                    } catch (IOException e) {
-                        message = e.getMessage();
-                    }
-                }
-            }
-
-
-        }
-        return statusValue + ";" + message;
+        return new FalconCLIException(statusValue + ";" + message);
     }
 }

http://git-wip-us.apache.org/repos/asf/falcon/blob/ae002a01/client/src/main/java/org/apache/falcon/client/FalconClient.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/client/FalconClient.java b/client/src/main/java/org/apache/falcon/client/FalconClient.java
index 46b32dd..4ee21aa 100644
--- a/client/src/main/java/org/apache/falcon/client/FalconClient.java
+++ b/client/src/main/java/org/apache/falcon/client/FalconClient.java
@@ -524,12 +524,12 @@ public class FalconClient extends AbstractFalconClient {
                                        String colo, List<LifeCycle> lifeCycles, String filterBy,
                                        String orderBy, String sortOrder,
                                        Integer offset, Integer numResults, String doAsUser) throws FalconCLIException {
-        ClientResponse clientResponse = new ResourceBuilder().path(Instances.RUNNING.path, type, entity)
+        ClientResponse clientResponse = new ResourceBuilder().path(Instances.STATUS.path, type, entity)
             .addQueryParam(FILTER_BY, filterBy).addQueryParam(ORDER_BY, orderBy)
             .addQueryParam(SORT_ORDER, sortOrder).addQueryParam(OFFSET, offset)
             .addQueryParam(START, start).addQueryParam(END, end)
             .addQueryParam(NUM_RESULTS, numResults).addQueryParam(COLO, colo)
-            .addQueryParam(LIFECYCLE, lifeCycles, type).addQueryParam(USER, doAsUser).call(Instances.RUNNING);
+            .addQueryParam(LIFECYCLE, lifeCycles, type).addQueryParam(USER, doAsUser).call(Instances.STATUS);
         return getResponse(InstancesResult.class, clientResponse);
     }
 
@@ -706,7 +706,7 @@ public class FalconClient extends AbstractFalconClient {
     private <T extends APIResult> T getResponse(Class<T> clazz,
                                                 ClientResponse clientResponse) throws FalconCLIException {
         printClientResponse(clientResponse);
-        checkIfSuccessful(clientResponse, clazz);
+        checkIfSuccessful(clientResponse);
         return clientResponse.getEntity(clazz);
     }
 
@@ -1042,23 +1042,10 @@ public class FalconClient extends AbstractFalconClient {
         return getResponseAsString(clientResponse);
     }
 
-    /*
-     * Donot use this getMessage use the overloaded one
-    * with clazz as param for better error handling
-    * */
     private void checkIfSuccessful(ClientResponse clientResponse) throws FalconCLIException {
         Response.Status.Family statusFamily = clientResponse.getClientResponseStatus().getFamily();
-        if (statusFamily != Response.Status.Family.SUCCESSFUL
-                && statusFamily != Response.Status.Family.INFORMATIONAL) {
-            throw FalconCLIException.fromReponse(clientResponse);
-        }
-    }
-
-    private void checkIfSuccessful(ClientResponse clientResponse,
-                                   Class<? extends APIResult> clazz) throws FalconCLIException {
-        Response.Status.Family statusFamily = clientResponse.getClientResponseStatus().getFamily();
         if (statusFamily != Response.Status.Family.SUCCESSFUL && statusFamily != Response.Status.Family.INFORMATIONAL) {
-            throw FalconCLIException.fromReponse(clientResponse, clazz);
+            throw FalconCLIException.fromReponse(clientResponse);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/falcon/blob/ae002a01/prism/src/main/java/org/apache/falcon/FalconWebException.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/FalconWebException.java b/prism/src/main/java/org/apache/falcon/FalconWebException.java
index 663420a..0094f38 100644
--- a/prism/src/main/java/org/apache/falcon/FalconWebException.java
+++ b/prism/src/main/java/org/apache/falcon/FalconWebException.java
@@ -63,7 +63,10 @@ public class FalconWebException extends WebApplicationException {
     }
 
     private static String getMessage(Throwable e) {
-        return e.getCause()==null? e.getMessage():e.getMessage() + "\nCausedBy: " + e.getCause().getMessage();
+        if (e instanceof FalconWebException) {
+            return ((APIResult)((FalconWebException) e).getResponse().getEntity()).getMessage();
+        }
+        return e.getCause() == null ? e.getMessage() : e.getMessage() + "\nCausedBy: " + e.getCause().getMessage();
     }
 
     public FalconWebException(Response response) {

http://git-wip-us.apache.org/repos/asf/falcon/blob/ae002a01/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 9e81209..2225c09 100644
--- a/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
+++ b/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
@@ -870,7 +870,7 @@ public abstract class AbstractInstanceManager extends AbstractEntityManager {
         Date endDate = getEndDate(endStr, clusterStartEndDates.second);
         Date startDate = getStartDate(startStr, endDate, clusterStartEndDates.first, frequency, numResults);
         if (startDate.after(endDate)) {
-            throw FalconWebException.newAPIException("Specified End date "
+            throw new IllegalArgumentException("Specified End date "
                     + SchemaHelper.getDateFormat().format(endDate)
                     + " is before the entity was scheduled "
                     + SchemaHelper.getDateFormat().format(startDate));

http://git-wip-us.apache.org/repos/asf/falcon/blob/ae002a01/prism/src/main/java/org/apache/falcon/resource/AbstractSchedulableEntityManager.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/resource/AbstractSchedulableEntityManager.java b/prism/src/main/java/org/apache/falcon/resource/AbstractSchedulableEntityManager.java
index 18df32f..8d7a5df 100644
--- a/prism/src/main/java/org/apache/falcon/resource/AbstractSchedulableEntityManager.java
+++ b/prism/src/main/java/org/apache/falcon/resource/AbstractSchedulableEntityManager.java
@@ -96,13 +96,14 @@ public abstract class AbstractSchedulableEntityManager extends AbstractInstanceM
             entityObj = EntityUtil.getEntity(type, entity);
             //first acquire lock on entity before scheduling
             if (!memoryLocks.acquireLock(entityObj, "schedule")) {
-                throw new FalconException("Looks like an schedule/update command is already running for "
-                        + entityObj.toShortString());
+                throw  FalconWebException.newAPIException("Looks like an schedule/update command is already"
+                        + " running for " + entityObj.toShortString());
             }
             LOG.info("Memory lock obtained for {} by {}", entityObj.toShortString(), Thread.currentThread().getName());
             WorkflowEngineFactory.getWorkflowEngine(entityObj, properties).schedule(entityObj, skipDryRun, properties);
         } catch (Exception e) {
-            throw new FalconException("Entity schedule failed for " + type + ": " + entity, e);
+            LOG.error("Entity schedule failed for " + type + ": " + entity, e);
+            throw FalconWebException.newAPIException("Entity schedule failed for " + type + ": " + entity);
         } finally {
             if (entityObj != null) {
                 memoryLocks.releaseLock(entityObj);
@@ -223,7 +224,7 @@ public abstract class AbstractSchedulableEntityManager extends AbstractInstanceM
             if (getWorkflowEngine(entityObj).isActive(entityObj)) {
                 getWorkflowEngine(entityObj).suspend(entityObj);
             } else {
-                throw new FalconException(entity + "(" + type + ") is not scheduled");
+                throw  FalconWebException.newAPIException(entity + "(" + type + ") is not scheduled");
             }
             return new APIResult(APIResult.Status.SUCCEEDED, entity + "(" + type + ") suspended successfully");
         } catch (Throwable e) {
@@ -251,10 +252,10 @@ public abstract class AbstractSchedulableEntityManager extends AbstractInstanceM
             if (getWorkflowEngine(entityObj).isActive(entityObj)) {
                 getWorkflowEngine(entityObj).resume(entityObj);
             } else {
-                throw new FalconException(entity + "(" + type + ") is not scheduled");
+                throw new IllegalStateException(entity + "(" + type + ") is not scheduled");
             }
             return new APIResult(APIResult.Status.SUCCEEDED, entity + "(" + type + ") resumed successfully");
-        } catch (Throwable e) {
+        } catch (Exception e) {
             LOG.error("Unable to resume entity", e);
             throw FalconWebException.newAPIException(e);
         }
@@ -300,7 +301,9 @@ public abstract class AbstractSchedulableEntityManager extends AbstractInstanceM
                             cluster, doAsUser),
                     orderBy, sortOrder, offset, resultsPerPage);
             colo = ((Cluster) configStore.get(EntityType.CLUSTER, cluster)).getColo();
-        } catch (Exception e) {
+        } catch (FalconWebException e) {
+            throw e;
+        } catch(Exception e) {
             LOG.error("Failed to get entities", e);
             throw FalconWebException.newAPIException(e);
         }

http://git-wip-us.apache.org/repos/asf/falcon/blob/ae002a01/prism/src/main/java/org/apache/falcon/resource/proxy/SchedulableEntityManagerProxy.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/resource/proxy/SchedulableEntityManagerProxy.java b/prism/src/main/java/org/apache/falcon/resource/proxy/SchedulableEntityManagerProxy.java
index f721bd0..2dc727d 100644
--- a/prism/src/main/java/org/apache/falcon/resource/proxy/SchedulableEntityManagerProxy.java
+++ b/prism/src/main/java/org/apache/falcon/resource/proxy/SchedulableEntityManagerProxy.java
@@ -771,9 +771,12 @@ public class SchedulableEntityManagerProxy extends AbstractSchedulableEntityMana
             for (String colo : colos) {
                 try {
                     results.put(colo, doExecute(colo));
-                } catch (Throwable e) {
-                    results.put(colo, getResultInstance(APIResult.Status.FAILED, e.getClass().getName() + "::"
-                            + e.getMessage()));
+                } catch (FalconWebException e) {
+                    String message = ((APIResult) e.getResponse().getEntity()).getMessage();
+                    results.put(colo, getResultInstance(APIResult.Status.FAILED, message));
+                } catch (Throwable throwable) {
+                    results.put(colo, getResultInstance(APIResult.Status.FAILED, throwable.getClass().getName() + "::"
+                        + throwable.getMessage()));
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/falcon/blob/ae002a01/webapp/src/main/java/org/apache/falcon/resource/ConfigSyncService.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/falcon/resource/ConfigSyncService.java b/webapp/src/main/java/org/apache/falcon/resource/ConfigSyncService.java
index bf538dc..aa15dcc 100644
--- a/webapp/src/main/java/org/apache/falcon/resource/ConfigSyncService.java
+++ b/webapp/src/main/java/org/apache/falcon/resource/ConfigSyncService.java
@@ -18,6 +18,7 @@
 
 package org.apache.falcon.resource;
 
+import org.apache.falcon.FalconWebException;
 import org.apache.falcon.monitors.Dimension;
 import org.apache.falcon.monitors.Monitored;
 
@@ -47,7 +48,11 @@ public class ConfigSyncService extends AbstractEntityManager {
     public APIResult submit(@Context HttpServletRequest request,
                             @Dimension("entityType") @PathParam("type") String type,
                             @Dimension("colo") @QueryParam("colo") String colo) {
-        return super.submit(request, type, colo);
+        try {
+            return super.submit(request, type, colo);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @DELETE
@@ -59,7 +64,11 @@ public class ConfigSyncService extends AbstractEntityManager {
                             @Dimension("entityType") @PathParam("type") String type,
                             @Dimension("entityName") @PathParam("entity") String entity,
                             @Dimension("colo") @QueryParam("colo") String colo) {
-        return super.delete(request, type, entity, colo);
+        try {
+            return super.delete(request, type, entity, colo);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @POST
@@ -72,6 +81,10 @@ public class ConfigSyncService extends AbstractEntityManager {
                             @Dimension("entityName") @PathParam("entity") String entityName,
                             @Dimension("colo") @QueryParam("colo") String colo,
                             @QueryParam("skipDryRun") Boolean skipDryRun) {
-        return super.update(request, type, entityName, colo, skipDryRun);
+        try {
+            return super.update(request, type, entityName, colo, skipDryRun);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/falcon/blob/ae002a01/webapp/src/main/java/org/apache/falcon/resource/InstanceManager.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/falcon/resource/InstanceManager.java b/webapp/src/main/java/org/apache/falcon/resource/InstanceManager.java
index 76c66f3..696136c 100644
--- a/webapp/src/main/java/org/apache/falcon/resource/InstanceManager.java
+++ b/webapp/src/main/java/org/apache/falcon/resource/InstanceManager.java
@@ -18,6 +18,7 @@
 
 package org.apache.falcon.resource;
 
+import org.apache.falcon.FalconWebException;
 import org.apache.falcon.LifeCycle;
 import org.apache.falcon.monitors.Dimension;
 import org.apache.falcon.monitors.Monitored;
@@ -56,9 +57,13 @@ public class InstanceManager extends AbstractInstanceManager {
             @DefaultValue("") @QueryParam("sortOrder") String sortOrder,
             @DefaultValue("0") @QueryParam("offset") Integer offset,
             @QueryParam("numResults") Integer resultsPerPage) {
-        resultsPerPage = resultsPerPage == null ? getDefaultResultsPerPage() : resultsPerPage;
-        return super.getRunningInstances(type, entity, colo, lifeCycles, filterBy,
+        try {
+            resultsPerPage = resultsPerPage == null ? getDefaultResultsPerPage() : resultsPerPage;
+            return super.getRunningInstances(type, entity, colo, lifeCycles, filterBy,
                 orderBy, sortOrder, offset, resultsPerPage);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     /*
@@ -82,9 +87,13 @@ public class InstanceManager extends AbstractInstanceManager {
             @DefaultValue("") @QueryParam("sortOrder") String sortOrder,
             @DefaultValue("0") @QueryParam("offset") Integer offset,
             @QueryParam("numResults") Integer resultsPerPage) {
-        resultsPerPage = resultsPerPage == null ? getDefaultResultsPerPage() : resultsPerPage;
-        return super.getInstances(type, entity, startStr, endStr, colo, lifeCycles,
+        try {
+            resultsPerPage = resultsPerPage == null ? getDefaultResultsPerPage() : resultsPerPage;
+            return super.getInstances(type, entity, startStr, endStr, colo, lifeCycles,
                 filterBy, orderBy, sortOrder, offset, resultsPerPage);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @GET
@@ -104,9 +113,13 @@ public class InstanceManager extends AbstractInstanceManager {
             @DefaultValue("") @QueryParam("sortOrder") String sortOrder,
             @DefaultValue("0") @QueryParam("offset") Integer offset,
             @QueryParam("numResults") Integer resultsPerPage) {
-        resultsPerPage = resultsPerPage == null ? getDefaultResultsPerPage() : resultsPerPage;
-        return super.getStatus(type, entity, startStr, endStr, colo, lifeCycles,
+        try {
+            resultsPerPage = resultsPerPage == null ? getDefaultResultsPerPage() : resultsPerPage;
+            return super.getStatus(type, entity, startStr, endStr, colo, lifeCycles,
                 filterBy, orderBy, sortOrder, offset, resultsPerPage);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @GET
@@ -123,8 +136,12 @@ public class InstanceManager extends AbstractInstanceManager {
             @DefaultValue("") @QueryParam("filterBy") String filterBy,
             @DefaultValue("") @QueryParam("orderBy") String orderBy,
             @DefaultValue("") @QueryParam("sortOrder") String sortOrder) {
-        return super.getSummary(type, entity, startStr, endStr, colo, lifeCycles,
+        try {
+            return super.getSummary(type, entity, startStr, endStr, colo, lifeCycles,
                 filterBy, orderBy, sortOrder);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @GET
@@ -138,7 +155,11 @@ public class InstanceManager extends AbstractInstanceManager {
             @Dimension("start-time") @QueryParam("start") String start,
             @Dimension("end-time") @QueryParam("end") String end,
             @Dimension("colo") @QueryParam("colo") String colo) {
-        return super.getListing(type, entity, start, end, colo);
+        try {
+            return super.getListing(type, entity, start, end, colo);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @GET
@@ -159,9 +180,13 @@ public class InstanceManager extends AbstractInstanceManager {
             @DefaultValue("") @QueryParam("sortOrder") String sortOrder,
             @DefaultValue("0") @QueryParam("offset") Integer offset,
             @QueryParam("numResults") Integer resultsPerPage) {
-        resultsPerPage = resultsPerPage == null ? getDefaultResultsPerPage() : resultsPerPage;
-        return super.getLogs(type, entity, startStr, endStr, colo, runId, lifeCycles,
+        try {
+            resultsPerPage = resultsPerPage == null ? getDefaultResultsPerPage() : resultsPerPage;
+            return super.getLogs(type, entity, startStr, endStr, colo, runId, lifeCycles,
                 filterBy, orderBy, sortOrder, offset, resultsPerPage);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @GET
@@ -175,7 +200,11 @@ public class InstanceManager extends AbstractInstanceManager {
             @Dimension("start-time") @QueryParam("start") String start,
             @Dimension("colo") @QueryParam("colo") String colo,
             @Dimension("lifecycle") @QueryParam("lifecycle") List<LifeCycle> lifeCycles) {
-        return super.getInstanceParams(type, entity, start, colo, lifeCycles);
+        try {
+            return super.getInstanceParams(type, entity, start, colo, lifeCycles);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @POST
@@ -191,7 +220,11 @@ public class InstanceManager extends AbstractInstanceManager {
             @Dimension("end-time") @QueryParam("end") String endStr,
             @Dimension("colo") @QueryParam("colo") String colo,
             @Dimension("lifecycle") @QueryParam("lifecycle") List<LifeCycle> lifeCycles) {
-        return super.killInstance(request, type, entity, startStr, endStr, colo, lifeCycles);
+        try {
+            return super.killInstance(request, type, entity, startStr, endStr, colo, lifeCycles);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @POST
@@ -207,7 +240,11 @@ public class InstanceManager extends AbstractInstanceManager {
             @Dimension("end-time") @QueryParam("end") String endStr,
             @Dimension("colo") @QueryParam("colo") String colo,
             @Dimension("lifecycle") @QueryParam("lifecycle") List<LifeCycle> lifeCycles) {
-        return super.suspendInstance(request, type, entity, startStr, endStr, colo, lifeCycles);
+        try {
+            return super.suspendInstance(request, type, entity, startStr, endStr, colo, lifeCycles);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @POST
@@ -223,7 +260,11 @@ public class InstanceManager extends AbstractInstanceManager {
             @Dimension("end-time") @QueryParam("end") String endStr,
             @Dimension("colo") @QueryParam("colo") String colo,
             @Dimension("lifecycle") @QueryParam("lifecycle") List<LifeCycle> lifeCycles) {
-        return super.resumeInstance(request, type, entity, startStr, endStr, colo, lifeCycles);
+        try {
+            return super.resumeInstance(request, type, entity, startStr, endStr, colo, lifeCycles);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @GET
@@ -236,7 +277,11 @@ public class InstanceManager extends AbstractInstanceManager {
             @Dimension("name") @PathParam("name") String entityName,
             @Dimension("instanceTime") @QueryParam("start") String instanceTime,
             @Dimension("colo") @QueryParam("colo") String colo) {
-        return super.triageInstance(entityType, entityName, instanceTime, colo);
+        try {
+            return super.triageInstance(entityType, entityName, instanceTime, colo);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @POST
@@ -253,7 +298,11 @@ public class InstanceManager extends AbstractInstanceManager {
             @Dimension("colo") @QueryParam("colo") String colo,
             @Dimension("lifecycle") @QueryParam("lifecycle") List<LifeCycle> lifeCycles,
             @Dimension("force") @QueryParam("force") Boolean isForced) {
-        return super.reRunInstance(type, entity, startStr, endStr, request, colo, lifeCycles, isForced);
+        try {
+            return super.reRunInstance(type, entity, startStr, endStr, request, colo, lifeCycles, isForced);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
     //RESUME CHECKSTYLE CHECK ParameterNumberCheck
 
@@ -267,6 +316,10 @@ public class InstanceManager extends AbstractInstanceManager {
             @Dimension("entityName") @PathParam("entity") String entityName,
             @Dimension("instanceTime") @QueryParam("instanceTime") String instanceTimeStr,
             @Dimension("colo") @QueryParam("colo") String colo) {
-        return super.getInstanceDependencies(entityType, entityName, instanceTimeStr, colo);
+        try {
+            return super.getInstanceDependencies(entityType, entityName, instanceTimeStr, colo);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/falcon/blob/ae002a01/webapp/src/main/java/org/apache/falcon/resource/SchedulableEntityManager.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/falcon/resource/SchedulableEntityManager.java b/webapp/src/main/java/org/apache/falcon/resource/SchedulableEntityManager.java
index 8f8f56f..afa2b6f 100644
--- a/webapp/src/main/java/org/apache/falcon/resource/SchedulableEntityManager.java
+++ b/webapp/src/main/java/org/apache/falcon/resource/SchedulableEntityManager.java
@@ -50,7 +50,11 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager {
                                @Dimension("entityName") @PathParam("entity") String entity,
                                @Dimension("colo") @QueryParam("colo") final String colo,
                                @Dimension("showScheduler") @QueryParam("showScheduler") final Boolean showScheduler) {
-        return super.getStatus(type, entity, colo, showScheduler);
+        try {
+            return super.getStatus(type, entity, colo, showScheduler);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @GET
@@ -65,10 +69,10 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager {
             @Dimension("colo") @QueryParam("colo") final String colo) {
         try {
             validateSlaParams(entityType, entityName, start, end, colo);
-        } catch (Exception e) {
+            return super.getFeedSLAMissPendingAlerts(entityName, start, end, colo);
+        } catch (Throwable e) {
             throw FalconWebException.newAPIException(e);
         }
-        return super.getFeedSLAMissPendingAlerts(entityName, start, end, colo);
     }
 
     @GET
@@ -78,7 +82,11 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager {
     @Override
     public EntityList getDependencies(@Dimension("entityType") @PathParam("type") String type,
                                       @Dimension("entityName") @PathParam("entity") String entity) {
-        return super.getDependencies(type, entity);
+        try {
+            return super.getDependencies(type, entity);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     //SUSPEND CHECKSTYLE CHECK ParameterNumberCheck
@@ -98,12 +106,16 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager {
                                     @DefaultValue("0") @QueryParam("offset") Integer offset,
                                     @QueryParam("numResults") Integer resultsPerPage,
                                     @DefaultValue("") @QueryParam("doAs") String doAsUser) {
-        if (StringUtils.isNotEmpty(type)) {
-            type = type.substring(1);
-        }
-        resultsPerPage = resultsPerPage == null ? getDefaultResultsPerPage() : resultsPerPage;
-        return super.getEntityList(fields, nameSubsequence, tagKeywords, type, tags, filterBy,
+        try {
+            if (StringUtils.isNotEmpty(type)) {
+                type = type.substring(1);
+            }
+            resultsPerPage = resultsPerPage == null ? getDefaultResultsPerPage() : resultsPerPage;
+            return super.getEntityList(fields, nameSubsequence, tagKeywords, type, tags, filterBy,
                 orderBy, sortOrder, offset, resultsPerPage, doAsUser);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @GET
@@ -125,8 +137,12 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager {
             @DefaultValue("10") @QueryParam("numResults") Integer numEntities,
             @DefaultValue("7") @QueryParam("numInstances") Integer numInstanceResults,
             @DefaultValue("") @QueryParam("doAs") final String doAsUser) {
-        return super.getEntitySummary(type, cluster, startStr, endStr, fields, entityFilter, entityTags,
+        try {
+            return super.getEntitySummary(type, cluster, startStr, endStr, fields, entityFilter, entityTags,
                 entityOrderBy, entitySortOrder, entityOffset, numEntities, numInstanceResults, doAsUser);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
     //RESUME CHECKSTYLE CHECK ParameterNumberCheck
 
@@ -137,7 +153,11 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager {
     @Override
     public String getEntityDefinition(@Dimension("type") @PathParam("type") String type,
                                       @Dimension("entity") @PathParam("entity") String entityName) {
-        return super.getEntityDefinition(type, entityName);
+        try {
+            return super.getEntityDefinition(type, entityName);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @POST
@@ -151,7 +171,11 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager {
                               @Dimension("colo") @QueryParam("colo") String colo,
                               @QueryParam("skipDryRun") Boolean skipDryRun,
                               @QueryParam("properties") String properties) {
-        return super.schedule(request, type, entity, colo, skipDryRun, properties);
+        try {
+            return super.schedule(request, type, entity, colo, skipDryRun, properties);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @POST
@@ -163,7 +187,11 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager {
                              @Dimension("entityType") @PathParam("type") String type,
                              @Dimension("entityName") @PathParam("entity") String entity,
                              @Dimension("colo") @QueryParam("colo") String colo) {
-        return super.suspend(request, type, entity, colo);
+        try {
+            return super.suspend(request, type, entity, colo);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @POST
@@ -175,7 +203,11 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager {
                             @Dimension("entityType") @PathParam("type") String type,
                             @Dimension("entityName") @PathParam("entity") String entity,
                             @Dimension("colo") @QueryParam("colo") String colo) {
-        return super.resume(request, type, entity, colo);
+        try {
+            return super.resume(request, type, entity, colo);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @POST
@@ -186,7 +218,11 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager {
     @Override
     public APIResult validate(@Context HttpServletRequest request, @PathParam("type") String type,
                               @QueryParam("skipDryRun") Boolean skipDryRun) {
-        return super.validate(request, type, skipDryRun);
+        try {
+            return super.validate(request, type, skipDryRun);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @POST
@@ -198,7 +234,11 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager {
                            @Dimension("entityName") @PathParam("entity") String entityName,
                            @Dimension("colo") @QueryParam("colo") String colo,
                            @QueryParam("skipDryRun") Boolean skipDryRun) {
-        return super.touch(type, entityName, colo, skipDryRun);
+        try {
+            return super.touch(type, entityName, colo, skipDryRun);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @GET
@@ -208,7 +248,10 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager {
     public FeedLookupResult reverseLookup(
             @Dimension("type") @PathParam("type") String type,
             @Dimension("path") @QueryParam("path") String instancePath) {
-        return super.reverseLookup(type, instancePath);
+        try {
+            return super.reverseLookup(type, instancePath);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
-
 }