hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "cuijianwei (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HBASE-10064) AggregateClient.validateParameters will throw NullPointerException when set startRow/stopRow of scan to null
Date Mon, 02 Dec 2013 09:03:35 GMT

     [ https://issues.apache.org/jira/browse/HBASE-10064?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

cuijianwei updated HBASE-10064:
-------------------------------

    Attachment: HBASE-10064-0.94-v1.patch

This patch resolve the problem by setting startRow/stopRow to EMPTY_START_ROW/EMPTY_END_ROW
if user invokes scan.setStartRow(null)/scan.setStopRow(null)

> AggregateClient.validateParameters will throw NullPointerException when set startRow/stopRow
of scan to null
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-10064
>                 URL: https://issues.apache.org/jira/browse/HBASE-10064
>             Project: HBase
>          Issue Type: Bug
>          Components: Client
>    Affects Versions: 0.94.14
>            Reporter: cuijianwei
>         Attachments: HBASE-10064-0.94-v1.patch
>
>
> When using methods such as max(...), min(...) in AggregationClient, we will pass Scan
as parameter. These methods will throw NullPointerException if users invoke scan.setStartRow(null)
or scan.setStopRow(null) before passing the scan as parameter.  The NullPointerException is
thrown by validateParameters(Scan scan) which will be invoked before sending requests  to
server. The implementation of validateParameters is :
> {code}
>   private void validateParameters(Scan scan) throws IOException {
>     if (scan == null
>         || (Bytes.equals(scan.getStartRow(), scan.getStopRow()) && !Bytes
>             .equals(scan.getStartRow(), HConstants.EMPTY_START_ROW))
>         || ((Bytes.compareTo(scan.getStartRow(), scan.getStopRow()) > 0) &&
>         	!Bytes.equals(scan.getStopRow(), HConstants.EMPTY_END_ROW))) {
>       throw new IOException(
>           "Agg client Exception: Startrow should be smaller than Stoprow");
>     } else if (scan.getFamilyMap().size() != 1) {
>       throw new IOException("There must be only one family.");
>     }
>   }
> {code}
> “Bytes.equals(scan.getStartRow(), HConstants.EMPTY_START_ROW)” will throw NullPointerException
if the startRow of scan is set to null.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message