You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "James Taylor (JIRA)" <ji...@apache.org> on 2015/11/05 06:11:27 UTC
[jira] [Commented] (PHOENIX-2372) PhoenixResultSet.getDate(int,
Calendar) causes NPE on a null value
[ https://issues.apache.org/jira/browse/PHOENIX-2372?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14991140#comment-14991140 ]
James Taylor commented on PHOENIX-2372:
---------------------------------------
Thanks, [~elserj]. Looks good, but you'll need to set wasNull too, like this:
{code}
wasNull = (value == null);
if (value == null) {
return null;
}
{code}
Bonus points if you check other date-related setters. :-)
> PhoenixResultSet.getDate(int, Calendar) causes NPE on a null value
> ------------------------------------------------------------------
>
> Key: PHOENIX-2372
> URL: https://issues.apache.org/jira/browse/PHOENIX-2372
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.4.0, 4.5.0, 4.6.0
> Reporter: Josh Elser
> Assignee: Josh Elser
> Attachments: PHOENIX-2372.001.patch
>
>
> Ran a simple query through PQS:
> {code}
> select * from system.stats;
> {code}
> and got back a stack trace (trimmed for relevance)
> {noformat}
> java.lang.NullPointerException
> at java.util.Calendar.setTime(Calendar.java:1770)
> at org.apache.phoenix.jdbc.PhoenixResultSet.getDate(PhoenixResultSet.java:377)
> at org.apache.calcite.avatica.jdbc.JdbcResultSet.getValue(JdbcResultSet.java:172)
> at org.apache.calcite.avatica.jdbc.JdbcResultSet.frame(JdbcResultSet.java:142)
> {noformat}
> It looks like the {{getDate(int, Calendar)}} method on PhoenixResultSet doesn't check the value before passing it into the calendar.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)