falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajayyad...@apache.org
Subject falcon git commit: FALCON-1748 Client throws FalconWebException irrespective of type of error. Contributed by Praveen Adlakha.
Date Thu, 21 Jan 2016 08:49:14 GMT
Repository: falcon
Updated Branches:
  refs/heads/master ecefdd079 -> 65ee6106b


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/65ee6106
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/65ee6106
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/65ee6106

Branch: refs/heads/master
Commit: 65ee6106b2c8988da5f7d987bd6839892f31fe44
Parents: ecefdd0
Author: Ajay Yadava <ajaynsit@gmail.com>
Authored: Wed Jan 20 22:41:27 2016 +0530
Committer: Ajay Yadava <ajaynsit@gmail.com>
Committed: Wed Jan 20 22:41:27 2016 +0530

----------------------------------------------------------------------
 CHANGES.txt                                     |  4 +-
 .../falcon/client/FalconCLIException.java       | 51 +-----------
 .../org/apache/falcon/client/FalconClient.java  | 20 +----
 .../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, 178 insertions(+), 115 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/65ee6106/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index fbd66b8..74da042 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -44,7 +44,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)
     
@@ -120,6 +120,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/65ee6106/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/65ee6106/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 52ecef2..597f608 100644
--- a/client/src/main/java/org/apache/falcon/client/FalconClient.java
+++ b/client/src/main/java/org/apache/falcon/client/FalconClient.java
@@ -116,6 +116,7 @@ public class FalconClient extends AbstractFalconClient {
     private static final String TAG_KEYWORDS = "tagkeys";
     private static final String LIFECYCLE = "lifecycle";
     private static final String NUM_INSTANCES = "numInstances";
+    public static final String ALL_ATTEMPTS = "allAttempts";
 
 
 
@@ -529,7 +530,7 @@ public class FalconClient extends AbstractFalconClient {
             .addQueryParam(LIFECYCLE, lifeCycles, type).addQueryParam(FILTER_BY, filterBy)
             .addQueryParam(ORDER_BY, orderBy).addQueryParam(SORT_ORDER, sortOrder)
             .addQueryParam(OFFSET, offset).addQueryParam(NUM_RESULTS, numResults)
-            .addQueryParam(USER, doAsUser).call(Instances.STATUS);
+            .addQueryParam(ALL_ATTEMPTS, allAttempts).addQueryParam(USER, doAsUser).call(Instances.STATUS);
         return getResponse(InstancesResult.class, clientResponse);
     }
 
@@ -706,7 +707,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);
     }
 
@@ -1041,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/65ee6106/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/65ee6106/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 87bebd6..4001d55 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/65ee6106/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 6ca910e..8e300aa 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/65ee6106/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/65ee6106/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/65ee6106/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 ef8d77b..7108597 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);
+        }
     }
 
     /*
@@ -83,9 +88,13 @@ public class InstanceManager extends AbstractInstanceManager {
             @DefaultValue("0") @QueryParam("offset") Integer offset,
             @QueryParam("numResults") Integer resultsPerPage,
             @Dimension("allAttempts") @QueryParam("allAttempts") Boolean allAttempts) {
-        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, allAttempts);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @GET
@@ -106,9 +115,13 @@ public class InstanceManager extends AbstractInstanceManager {
             @DefaultValue("0") @QueryParam("offset") Integer offset,
             @QueryParam("numResults") Integer resultsPerPage,
             @Dimension("allAttempts") @QueryParam("allAttempts") Boolean allAttempts) {
-        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, allAttempts);
+        } catch (Throwable throwable) {
+            throw FalconWebException.newAPIException(throwable);
+        }
     }
 
     @GET
@@ -125,8 +138,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
@@ -140,7 +157,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
@@ -161,9 +182,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
@@ -177,7 +202,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
@@ -193,7 +222,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
@@ -209,7 +242,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
@@ -225,7 +262,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
@@ -238,7 +279,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
@@ -255,7 +300,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
 
@@ -269,6 +318,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/65ee6106/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);
+        }
     }
-
 }


Mime
View raw message