From aa2e21ceb673104899d6254f830bb37b5fb790f3 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Fri, 4 Sep 2009 04:57:26 +0000 Subject: [PATCH] HBASE-1779 ThriftServer logged error if getVer() result is empty git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@811220 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + .../hadoop/hbase/thrift/ThriftServer.java | 22 +++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 4b138495b42..9d02c0f6c68 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -11,6 +11,7 @@ Release 0.21.0 - Unreleased HBASE-1698 Review documentation for o.a.h.h.mapreduce HBASE-1798 [Regression] Unable to delete a row in the future HBASE-1790 filters are not working correctly (HBASE-1710 HBASE-1807 too) + HBASE-1779 ThriftServer logged error if getVer() result is empty IMPROVEMENTS HBASE-1760 Cleanup TODOs in HTable diff --git a/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java b/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java index e8ba93301cc..15324f94344 100644 --- a/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java +++ b/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java @@ -278,9 +278,11 @@ public class ThriftServer { get.setMaxVersions(numVersions); Result result = table.get(get); List cells = new ArrayList(); - for(KeyValue kv : result.sorted()) { - cells.add(new Cell(kv.getValue(), kv.getTimestamp())); - } + if ( ! result.isEmpty() ) { + for(KeyValue kv : result.sorted()) { + cells.add(new Cell(kv.getValue(), kv.getTimestamp())); + } + } return ThriftUtilities.cellFromHBase(cells.toArray(new Cell[0])); } catch (IOException e) { throw new IOError(e.getMessage()); @@ -304,12 +306,14 @@ public class ThriftServer { get.setTimeRange(Long.MIN_VALUE, timestamp); get.setMaxVersions(numVersions); Result result = table.get(get); - List cells = new ArrayList(); - KeyValue [] kvs = result.sorted(); - if (kvs != null) { - for(KeyValue kv : kvs) { - cells.add(new Cell(kv.getValue(), kv.getTimestamp())); - } + List cells = new ArrayList(); + if ( ! result.isEmpty() ) { + KeyValue [] kvs = result.sorted(); + if (kvs != null) { + for(KeyValue kv : kvs) { + cells.add(new Cell(kv.getValue(), kv.getTimestamp())); + } + } } return ThriftUtilities.cellFromHBase(cells.toArray(new Cell[0])); } catch (IOException e) {