hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Liyin Tang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-3731) NPE in HTable.getRegionsInfo()
Date Tue, 05 Apr 2011 00:07:05 GMT

    [ https://issues.apache.org/jira/browse/HBASE-3731?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13015692#comment-13015692
] 

Liyin Tang commented on HBASE-3731:
-----------------------------------

Sounds good to me.
But from the code, may be the original purpose of getHRegionInfo is to throw out IllegalArgumentException
if the parameter is null, while getHRegionInfoOrNull just return back null if the parameter
is null.
 


> NPE in HTable.getRegionsInfo()
> ------------------------------
>
>                 Key: HBASE-3731
>                 URL: https://issues.apache.org/jira/browse/HBASE-3731
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Liyin Tang
>
> In HTable.getRegionInfo
> <code>
> HRegionInfo info = Writables.getHRegionInfo(
>             rowResult.getValue(HConstants.CATALOG_FAMILY,
>                 HConstants.REGIONINFO_QUALIFIER));
> </code>
> But the rowResult.getValue() may return null, and Writables.getHRegionInfo will throw
NullPoinException when the parameter is null.
> 2 fixes here: 
> 1) In Writables.getHRegionInfo(). We need to check whether the data is null before using
data.length.
> 2)<code>
> HRegionInfo info = Writables.getHRegionInfoOrNull(
>             rowResult.getValue(HConstants.CATALOG_FAMILY,
>                 HConstants.REGIONINFO_QUALIFIER));
> if(info == null)
>   return false
> </code>
> Any thoughts?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message