Skip to content

DATACOUCH-36 - Don't allow NULL values to be stored. #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 8, 2013
Merged

DATACOUCH-36 - Don't allow NULL values to be stored. #9

merged 1 commit into from
Oct 8, 2013

Conversation

dharrigan
Copy link
Contributor

It is illegal to store a NULL value as a document. An attempt to do so will
throw an IllegalArgumentException.

-=david=-

It is illegal to store a NULL value as a document. An attempt to do so will
throw an IllegalArgumentException.

-=david=-
daschl added a commit that referenced this pull request Oct 8, 2013
DATACOUCH-36 - Don't allow NULL values to be stored.
@daschl daschl merged commit 270f573 into spring-projects:master Oct 8, 2013
@daschl
Copy link
Contributor

daschl commented Oct 8, 2013

👍 thanks!

@dharrigan
Copy link
Contributor Author

You're welcome :)

private void verifyValueType(final Object value) {
if(value == null) {
throw new IllegalArgumentException("Attribute of type null cannot be stored.");
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering that:

{ 
    "field1": {
        "field11": 123
    },
    "field2": null,
    "field3": "abc"
}

is valid json. Why the code throws exception in case of null value?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, I think that came from the fact that you cant store a NULL as a document in couchbase.. We should check somewhere else for that and allow it here probably.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you like another Jira ticket for this or can I create another pull request for the same ticket? Possibly reopen the ticket to document the new changes?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kdombeck jeah I think - since this one has already been released - we should do a new ticket and a new PR if you don't mind. cheers!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

@prettyvoid prettyvoid Sep 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kdombeck Any idea why I can't persist null fields (not null documents) using a CrudRepository? I want to save null fields.

bclozel added a commit that referenced this pull request Oct 30, 2014
Gem installation instructions updated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants