You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Marcel Villet <ma...@ctlab.com> on 2017/09/21 15:16:17 UTC

fromJson(null) throws java.lang.NullPointerException on Cassandra 3.11

Hi All

Basically, fromJson throws a java.lang.NullPointerException when NULL is passed, instead of just returning a NULL itself. Say I create a UDT and a table as follows:

create type type1
(
    id int,
    name text
);
	
create table table1
(
    id int,
    t FROZEN<type1>,
	
    primary key (id)
);

And then try and insert a row as such:

insert into table1 (id, t) VALUES (1, fromJson(null));

I get the error: java.lang.NullPointerException

This works:

insert into table1 (id, t) VALUES (1, null);

Programmatically, one does not always know when a UDT will be null, hence me expecting fromJson to just return null.

Would you agree that this might be a bug?

Regards
Marcel




This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager:administrator@ctlab.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@cassandra.apache.org
For additional commands, e-mail: user-help@cassandra.apache.org


RE: COMMERCIAL: Re: fromJson(null) throws java.lang.NullPointerException on Cassandra 3.11

Posted by Marcel Villet <ma...@ctlab.com>.
Cool thanks, will do.

-----Original Message-----
From: Jeff Jirsa [mailto:jjirsa@gmail.com] 
Sent: Thursday, September 21, 2017 5:58 PM
To: user@cassandra.apache.org
Subject: COMMERCIAL: Re: fromJson(null) throws java.lang.NullPointerException on Cassandra 3.11

It’s a bug. Should file a JIRA if one doesn’t already exist.

-- 
Jeff Jirsa


> On Sep 21, 2017, at 8:16 AM, Marcel Villet <ma...@ctlab.com> wrote:
> 
> Hi All
> 
> Basically, fromJson throws a java.lang.NullPointerException when NULL is passed, instead of just returning a NULL itself. Say I create a UDT and a table as follows:
> 
> create type type1
> (
>    id int,
>    name text
> );
>    
> create table table1
> (
>    id int,
>    t FROZEN<type1>,
>    
>    primary key (id)
> );
> 
> And then try and insert a row as such:
> 
> insert into table1 (id, t) VALUES (1, fromJson(null));
> 
> I get the error: java.lang.NullPointerException
> 
> This works:
> 
> insert into table1 (id, t) VALUES (1, null);
> 
> Programmatically, one does not always know when a UDT will be null, hence me expecting fromJson to just return null.
> 
> Would you agree that this might be a bug?
> 
> Regards
> Marcel
> 
> 
> 
> 
> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager:administrator@ctlab.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@cassandra.apache.org
> For additional commands, e-mail: user-help@cassandra.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@cassandra.apache.org
For additional commands, e-mail: user-help@cassandra.apache.org


Re: fromJson(null) throws java.lang.NullPointerException on Cassandra 3.11

Posted by Jeff Jirsa <jj...@gmail.com>.
It’s a bug. Should file a JIRA if one doesn’t already exist.

-- 
Jeff Jirsa


> On Sep 21, 2017, at 8:16 AM, Marcel Villet <ma...@ctlab.com> wrote:
> 
> Hi All
> 
> Basically, fromJson throws a java.lang.NullPointerException when NULL is passed, instead of just returning a NULL itself. Say I create a UDT and a table as follows:
> 
> create type type1
> (
>    id int,
>    name text
> );
>    
> create table table1
> (
>    id int,
>    t FROZEN<type1>,
>    
>    primary key (id)
> );
> 
> And then try and insert a row as such:
> 
> insert into table1 (id, t) VALUES (1, fromJson(null));
> 
> I get the error: java.lang.NullPointerException
> 
> This works:
> 
> insert into table1 (id, t) VALUES (1, null);
> 
> Programmatically, one does not always know when a UDT will be null, hence me expecting fromJson to just return null.
> 
> Would you agree that this might be a bug?
> 
> Regards
> Marcel
> 
> 
> 
> 
> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager:administrator@ctlab.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@cassandra.apache.org
> For additional commands, e-mail: user-help@cassandra.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@cassandra.apache.org
For additional commands, e-mail: user-help@cassandra.apache.org