cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sridharan Kuppa (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-4830) JdbcDate.compose is not null safe
Date Thu, 18 Oct 2012 17:58:04 GMT

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

Sridharan Kuppa updated CASSANDRA-4830:
---------------------------------------

    Description: 
I am using the cassandra-jdbc for CQL.  I have a table with timestamp column.  When timestamp
column is null it throws, IndexOutOfBoundsException exception since JdbcDate.compose calls
the new Date(ByteBufferUtil.toLong(value)).  The ByteBufferUtil.toLong(bytes) throws exception
the exception since position and limit pointers are same (similar to null).  This has to be
handled gracefully in the JdbcDate.compose method instead of throwing exception.  I would
like to see implementation something like,

    public Date compose(ByteBuffer bytes)
    {
        if(bytes.limit() - bytes.position() > 0) 
        {
            return new Date(ByteBufferUtil.toLong(bytes));
        } 
      
        return  null;
    }

BTW, this matches exactly reverse with decompose method.  Logically it supposed to be implemented
in the first place ;)



  was:
I am using the cassandra-jdbc for CQL.  I have a table with timestamp column.  When timestamp
column is null it throws, IndexOutOfBoundsException exception since JdbcDate.compose calls
the new Date(ByteBufferUtil.toLong(value)).  The ByteBufferUtil.toLong(bytes) throws exception
the exception since position and limit pointers are same (similar to null).  This has to be
handled gracefully in the JdbcDate.compose method instead of throwing exception.  I would
like to see implementation something like,

    public Date compose(ByteBuffer bytes)
    {
        if(bytes.position() - bytes.limit() > 0) 
        {
            return new Date(ByteBufferUtil.toLong(bytes));
        } 
      
        return  null;
    }

BTW, this matches exactly reverse with decompose method.  Logically it supposed to be implemented
in the first place ;)



    
> JdbcDate.compose is not null safe
> ---------------------------------
>
>                 Key: CASSANDRA-4830
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4830
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.1.5
>         Environment: Any
>            Reporter: Sridharan Kuppa
>
> I am using the cassandra-jdbc for CQL.  I have a table with timestamp column.  When timestamp
column is null it throws, IndexOutOfBoundsException exception since JdbcDate.compose calls
the new Date(ByteBufferUtil.toLong(value)).  The ByteBufferUtil.toLong(bytes) throws exception
the exception since position and limit pointers are same (similar to null).  This has to be
handled gracefully in the JdbcDate.compose method instead of throwing exception.  I would
like to see implementation something like,
>     public Date compose(ByteBuffer bytes)
>     {
>         if(bytes.limit() - bytes.position() > 0) 
>         {
>             return new Date(ByteBufferUtil.toLong(bytes));
>         } 
>       
>         return  null;
>     }
> BTW, this matches exactly reverse with decompose method.  Logically it supposed to be
implemented in the first place ;)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message