Uploaded image for project: 'Apache Cassandra'
  1. Apache Cassandra
  2. CASSANDRA-4830

JdbcDate.compose is not null safe

Log workAgile BoardRank to TopRank to BottomAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 1.1.7
    • None
    • None
    • Any

    • Low

    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

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            skuppa Sridharan Kuppa Assign to me
            skuppa Sridharan Kuppa
            Sridharan Kuppa
            Jonathan Ellis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment