falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From suh...@apache.org
Subject falcon git commit: FALCON-1117 Falcon Client throws NPE on no emtpy result in reverse lookup. Contributed by Ajay Yadava
Date Thu, 26 Mar 2015 09:44:32 GMT
Repository: falcon
Updated Branches:
  refs/heads/master 5b5113d19 -> 2eaaa4b20


FALCON-1117 Falcon Client throws NPE on no emtpy result in reverse lookup. 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/2eaaa4b2
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/2eaaa4b2
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/2eaaa4b2

Branch: refs/heads/master
Commit: 2eaaa4b20ca16b8bba8b2e4a4fa4e166d2d4a943
Parents: 5b5113d
Author: Suhas Vasu <suhas.v@inmobi.com>
Authored: Thu Mar 26 15:14:09 2015 +0530
Committer: Suhas Vasu <suhas.v@inmobi.com>
Committed: Thu Mar 26 15:14:09 2015 +0530

----------------------------------------------------------------------
 CHANGES.txt                                             |  3 +++
 .../src/main/java/org/apache/falcon/ResponseHelper.java | 12 ++++++++----
 .../org/apache/falcon/resource/FeedLookupResult.java    |  6 ++++--
 3 files changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/2eaaa4b2/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7a52e95..afd7266 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -117,6 +117,9 @@ Trunk (Unreleased)
    (Suhas vasu)
 
   BUG FIXES
+   FALCON-1117 Falcon Client throws NPE on no emtpy result in
+   reverse lookup (Ajay Yadava via Suhas Vasu)
+
    FALCON-1099 FeedReplicator: throws NPE (Sowmya Ramesh via Suhas Vasu)
 
    FALCON-1064 Build hangs at the following test: JMSMessageProducerTest

http://git-wip-us.apache.org/repos/asf/falcon/blob/2eaaa4b2/client/src/main/java/org/apache/falcon/ResponseHelper.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/ResponseHelper.java b/client/src/main/java/org/apache/falcon/ResponseHelper.java
index 4b40012..666e418 100644
--- a/client/src/main/java/org/apache/falcon/ResponseHelper.java
+++ b/client/src/main/java/org/apache/falcon/ResponseHelper.java
@@ -267,10 +267,14 @@ public final class ResponseHelper {
 
     public static String getString(FeedLookupResult feedLookupResult) {
         StringBuilder sb = new StringBuilder();
-        sb.append(feedLookupResult.toString());
-        sb.append("\nAdditional Information:\n");
-        sb.append("Response: ").append(feedLookupResult.getMessage());
-        sb.append("Request Id: ").append(feedLookupResult.getRequestId());
+        String results = feedLookupResult.toString();
+        if (StringUtils.isEmpty(results)) {
+            sb.append("No matching feeds found!");
+        } else {
+            sb.append(results);
+        }
+        sb.append("\n\nResponse: ").append(feedLookupResult.getMessage());
+        sb.append("\nRequest Id: ").append(feedLookupResult.getRequestId());
         return sb.toString();
     }
 }

http://git-wip-us.apache.org/repos/asf/falcon/blob/2eaaa4b2/client/src/main/java/org/apache/falcon/resource/FeedLookupResult.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/resource/FeedLookupResult.java b/client/src/main/java/org/apache/falcon/resource/FeedLookupResult.java
index 6edb59f..1198827 100644
--- a/client/src/main/java/org/apache/falcon/resource/FeedLookupResult.java
+++ b/client/src/main/java/org/apache/falcon/resource/FeedLookupResult.java
@@ -57,8 +57,10 @@ public class FeedLookupResult extends APIResult {
     @Override
     public String toString() {
         StringBuilder buffer = new StringBuilder();
-        for (FeedProperties element : elements) {
-            buffer.append(element.toString());
+        if (elements != null) {
+            for (FeedProperties element : elements) {
+                buffer.append(element.toString());
+            }
         }
         return buffer.toString();
     }


Mime
View raw message