Skip to content
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

Fix NPE when media type is null #56

Closed
wants to merge 2 commits into from

Conversation

rnowif
Copy link

@rnowif rnowif commented Jun 13, 2018

Hello,

I encounter a case where an operation returns a Blob without media type. In this case, this class fails with an NPE.

@kevinleturc
Copy link
Member

Hi,
It's a bit weird that you don't have Content-Type/mimeType value, blobs should always have a mime type. Maybe you're facing a server issue ?
On the other hand, it's still interesting to handle such case in client. I would like to replace null cases by usage of a DEFAULT mime type, for instance application/octet-stream. It allows to always have amimeType in nuxeo-java-client's blobs.
Will it be ok for your case ?

@rnowif
Copy link
Author

rnowif commented Jun 15, 2018

Hi,
Thank you for the quick reply.

Indeed, I agree that it may be a server issue but that it is relevant to handle it on the client side.
Your proposition to have a default media type seems ok to me. I propose to return this default MediaType here : https://github.com/nuxeo/nuxeo-java-client/blob/master/nuxeo-java-client/src/main/java/org/nuxeo/client/MediaType.java#L138

Is it good for you ?

@kevinleturc
Copy link
Member

Good location 👍
I addressed it in #57 during a refactoring of whole blob API. Now blob can't have a null media type unless you initialised it explicitly with null.

Thanks

@rnowif
Copy link
Author

rnowif commented Jun 19, 2018

Thank you very much 👍

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.

None yet

3 participants