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-1268 Instance Dependency API failure message is not intuitive in distributed mode. Contributed by Ajay Yadava.
Date Mon, 29 Jun 2015 09:26:03 GMT
Repository: falcon
Updated Branches:
  refs/heads/master bd4434333 -> 60161ae5a


FALCON-1268 Instance Dependency API failure message is not intuitive in distributed mode.
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/60161ae5
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/60161ae5
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/60161ae5

Branch: refs/heads/master
Commit: 60161ae5aff18715fbae83cdd7d9fdeab83084ec
Parents: bd44343
Author: Ajay Yadava <ajaynsit@gmail.com>
Authored: Mon Jun 29 14:48:18 2015 +0530
Committer: Ajay Yadava <ajaynsit@gmail.com>
Committed: Mon Jun 29 14:48:18 2015 +0530

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


http://git-wip-us.apache.org/repos/asf/falcon/blob/60161ae5/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 2928497..8d3bf53 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -45,6 +45,8 @@ Trunk (Unreleased)
     (Suhas Vasu)
 
   BUG FIXES
+    FALCON-1268 Instance Dependency API failure message is not intuitive in distributed mode
(Ajay Yadava)
+
     FALCON-1260 Instance dependency API produces incorrect results (Ajay Yadava)
     
     FALCON-99 Adding late data to process doesn't create new coord (Pallavi Rao via Suhas
Vasu)

http://git-wip-us.apache.org/repos/asf/falcon/blob/60161ae5/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 251a1c1..a4c63ab 100644
--- a/prism/src/main/java/org/apache/falcon/FalconWebException.java
+++ b/prism/src/main/java/org/apache/falcon/FalconWebException.java
@@ -19,6 +19,7 @@
 package org.apache.falcon;
 
 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.hadoop.security.authorize.AuthorizationException;
@@ -58,6 +59,19 @@ public class FalconWebException extends WebApplicationException {
         return new FalconWebException(Response.status(status).entity(result).type(MediaType.TEXT_XML_TYPE).build());
     }
 
+    public static FalconWebException newInstanceDependencyResult(Throwable e, Response.Status
status) {
+        String message = getMessage(e);
+        LOG.error("Action failed: {}\nError: {}", status, message);
+        APIResult result = new InstanceDependencyResult(APIResult.Status.FAILED, message);
+        return new FalconWebException(Response.status(status).entity(result).type(MediaType.TEXT_XML_TYPE).build());
+    }
+
+    public static FalconWebException newInstanceDependencyResult(String message, Response.Status
status) {
+        LOG.error("Action failed: {}\nError: {}", status, message);
+        APIResult result = new InstanceDependencyResult(APIResult.Status.FAILED, message);
+        return new FalconWebException(Response.status(status).entity(result).type(MediaType.TEXT_XML_TYPE).build());
+    }
+
     public static FalconWebException newException(APIResult result, Response.Status status)
{
         LOG.error("Action failed: {}\nError: {}", status, result.getMessage());
         return new FalconWebException(Response.status(status).

http://git-wip-us.apache.org/repos/asf/falcon/blob/60161ae5/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 d114d8d..1e813d2 100644
--- a/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
+++ b/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
@@ -221,14 +221,14 @@ public abstract class AbstractInstanceManager extends AbstractEntityManager
{
                     break;
 
                 default:
-                    throw FalconWebException.newInstanceException("Instance dependency isn't
supported for type: "
-                                + entityType, Response.Status.BAD_REQUEST);
+                    throw FalconWebException.newInstanceDependencyResult("Instance dependency
isn't supported for type:"
+                        + entityType, Response.Status.BAD_REQUEST);
                 }
             }
 
         } catch (Throwable throwable) {
             LOG.error("Failed to get instance dependencies:", throwable);
-            throw FalconWebException.newInstanceException(throwable, Response.Status.BAD_REQUEST);
+            throw FalconWebException.newInstanceDependencyResult(throwable, Response.Status.BAD_REQUEST);
         }
 
         InstanceDependencyResult res = new InstanceDependencyResult(APIResult.Status.SUCCEEDED,
"Success!");


Mime
View raw message