falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajayyad...@apache.org
Subject [2/3] falcon git commit: FALCON-1325 Triage API on prism, for an instance at which a process does not exist sends incorrect message. Contributed by Ajay Yadava
Date Wed, 29 Jul 2015 11:04:14 GMT
FALCON-1325 Triage API on prism, for an instance at which a process does not exist sends incorrect
message. Contributed by Ajay Yadava


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

Branch: refs/heads/master
Commit: 27c9a1f8b07d7b5985ab907c439583f50f99dcdc
Parents: d1942f4
Author: Ajay Yadava <ajaynsit@gmail.com>
Authored: Wed Jul 29 16:16:28 2015 +0530
Committer: Ajay Yadava <ajaynsit@gmail.com>
Committed: Wed Jul 29 16:16:28 2015 +0530

----------------------------------------------------------------------
 CHANGES.txt                                                 | 2 ++
 .../src/main/java/org/apache/falcon/FalconWebException.java | 9 +++++++++
 .../org/apache/falcon/resource/AbstractInstanceManager.java | 6 +++---
 3 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/27c9a1f8/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 13ea93f..f1ee843 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -67,6 +67,8 @@ Trunk (Unreleased)
     (Suhas Vasu)
 
   BUG FIXES
+    FALCON-1325 Triage API on prism, for an instance at which a process does not exist sends
incorrect message(Ajay Yadava)
+
     FALCON-1328 Error in Triage documentation(Karishma Gulati via Ajay Yadava)
 
     FALCON-1323 Reverse lookup of feeds causes NPE(Ajay Yadava)

http://git-wip-us.apache.org/repos/asf/falcon/blob/27c9a1f8/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 a4c63ab..d9a3be7 100644
--- a/prism/src/main/java/org/apache/falcon/FalconWebException.java
+++ b/prism/src/main/java/org/apache/falcon/FalconWebException.java
@@ -22,6 +22,7 @@ import org.apache.falcon.resource.APIResult;
 import org.apache.falcon.resource.InstanceDependencyResult;
 import org.apache.falcon.resource.InstancesResult;
 import org.apache.falcon.resource.InstancesSummaryResult;
+import org.apache.falcon.resource.TriageResult;
 import org.apache.hadoop.security.authorize.AuthorizationException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -52,6 +53,14 @@ public class FalconWebException extends WebApplicationException {
         return newInstanceException(getMessage(e), status);
     }
 
+
+    public static FalconWebException newTriageResultException(Throwable e, Response.Status
status) {
+        String message = getMessage(e);
+        LOG.error("Triage failed: {}\nError: {}", status, message);
+        APIResult result = new TriageResult(APIResult.Status.FAILED, message);
+        return new FalconWebException(Response.status(status).entity(result).type(MediaType.TEXT_XML_TYPE).build());
+    }
+
     public static FalconWebException newInstanceSummaryException(Throwable e, Response.Status
status) {
         String message = getMessage(e);
         LOG.error("Action failed: {}\nError: {}", status, message);

http://git-wip-us.apache.org/repos/asf/falcon/blob/27c9a1f8/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 bf42c85..adbad0e 100644
--- a/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
+++ b/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
@@ -656,13 +656,13 @@ public abstract class AbstractInstanceManager extends AbstractEntityManager
{
             return result;
         } catch (IllegalArgumentException e) { // bad entityType
             LOG.error("Bad Entity Type: {}", entityType);
-            throw FalconWebException.newInstanceException(e, Response.Status.BAD_REQUEST);
+            throw FalconWebException.newTriageResultException(e, Response.Status.BAD_REQUEST);
         } catch (EntityNotRegisteredException e) { // bad entityName
             LOG.error("Bad Entity Name : {}", entityName);
-            throw FalconWebException.newInstanceException(e, Response.Status.BAD_REQUEST);
+            throw FalconWebException.newTriageResultException(e, Response.Status.BAD_REQUEST);
         } catch (Throwable e) {
             LOG.error("Failed to triage", e);
-            throw FalconWebException.newInstanceException(e, Response.Status.INTERNAL_SERVER_ERROR);
+            throw FalconWebException.newTriageResultException(e, Response.Status.INTERNAL_SERVER_ERROR);
         }
     }
 


Mime
View raw message