falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaikid...@apache.org
Subject git commit: FALCON-319 Summary instance API returning wrong exception. Contributed by Shwetha GS.
Date Mon, 03 Mar 2014 18:55:48 GMT
Repository: incubator-falcon
Updated Branches:
  refs/heads/master 8825537cc -> bd2de46ff


FALCON-319 Summary instance API returning wrong exception. Contributed by Shwetha GS.


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

Branch: refs/heads/master
Commit: bd2de46ffa3956ffe9cd14068598ea20d2016bf3
Parents: 8825537
Author: shaikidris <psychidris@gmail.com>
Authored: Tue Mar 4 00:24:54 2014 +0530
Committer: shaikidris <psychidris@gmail.com>
Committed: Tue Mar 4 00:24:54 2014 +0530

----------------------------------------------------------------------
 CHANGES.txt                                              |  3 +++
 .../main/java/org/apache/falcon/client/FalconClient.java | 11 -----------
 .../main/java/org/apache/falcon/FalconWebException.java  |  8 ++++++++
 .../apache/falcon/resource/AbstractInstanceManager.java  |  7 ++-----
 4 files changed, 13 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/bd2de46f/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6d672bd..1c6b62d 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -57,6 +57,9 @@ Trunk (Unreleased)
     FALCON-123 Improve build speeds in falcon. (Srikanth Sundarrajan via Shwetha GS)
 
   BUG FIXES
+    FALCON-319 Summary instance API returning wrong exception. (Shwetha GS via 
+    Shaik Idris)
+
     FALCON-321 Feed evictor deleting more stuff than it should. (Shaik Idris)
 
     FALCON-330 Build fails for the module 'Apache Falcon CLI client ' on ubuntu.

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/bd2de46f/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 a5c31c2..59b2a3b 100644
--- a/client/src/main/java/org/apache/falcon/client/FalconClient.java
+++ b/client/src/main/java/org/apache/falcon/client/FalconClient.java
@@ -455,17 +455,6 @@ public class FalconClient {
         stream = new ByteArrayInputStream(buffer.toString().getBytes());
         return (buffer.length() == 0) ? null : stream;
     }
-    // private ServletInputStream getServletInputStream(final InputStream
-    // stream)
-    // throws IOException {
-    // return new ServletInputStream() {
-    //
-    // @Override
-    // public int read() throws IOException {
-    // return stream.read();
-    // }
-    // };
-    // }
 
     private String sendEntityRequest(Entities entities, String entityType,
                                      String entityName, String colo) throws FalconCLIException
{

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/bd2de46f/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 39340b6..65cf7d2 100644
--- a/prism/src/main/java/org/apache/falcon/FalconWebException.java
+++ b/prism/src/main/java/org/apache/falcon/FalconWebException.java
@@ -21,6 +21,7 @@ package org.apache.falcon;
 import org.apache.commons.lang.StringUtils;
 import org.apache.falcon.resource.APIResult;
 import org.apache.falcon.resource.InstancesResult;
+import org.apache.falcon.resource.InstancesSummaryResult;
 import org.apache.log4j.Logger;
 
 import javax.ws.rs.WebApplicationException;
@@ -45,6 +46,13 @@ public class FalconWebException extends WebApplicationException {
         return newInstanceException(e.getMessage() + "\n" + getAddnInfo(e), status);
     }
 
+    public static FalconWebException newInstanceSummaryException(Throwable e, Response.Status
status) {
+        LOG.error("Failure reason", e);
+        String message = e.getMessage() + "\n" + getAddnInfo(e);
+        LOG.error("Action failed: " + status + "\nError:" + message);
+        APIResult result = new InstancesSummaryResult(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) {

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/bd2de46f/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 4eef9ed..07ab2bc 100644
--- a/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
+++ b/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
@@ -96,8 +96,7 @@ public abstract class AbstractInstanceManager extends AbstractEntityManager
{
         }
     }
 
-    public InstancesSummaryResult getSummary(String type, String entity, String startStr,
String endStr,
-                                     String colo) {
+    public InstancesSummaryResult getSummary(String type, String entity, String startStr,
String endStr, String colo) {
         checkColo(colo);
         checkType(type);
         try {
@@ -111,14 +110,12 @@ public abstract class AbstractInstanceManager extends AbstractEntityManager
{
             return wfEngine.getSummary(entityObject, start, end);
         } catch (Throwable e) {
             LOG.error("Failed to get instances status", e);
-            throw FalconWebException
-                    .newInstanceException(e, Response.Status.BAD_REQUEST);
+            throw FalconWebException.newInstanceSummaryException(e, Response.Status.BAD_REQUEST);
         }
     }
 
     public InstancesResult getLogs(String type, String entity, String startStr,
                                    String endStr, String colo, String runId) {
-
         try {
             // TODO getStatus does all validations and filters clusters
             InstancesResult result = getStatus(type, entity, startStr, endStr,


Mime
View raw message