eclipse-ee4j / eclipse-ee4j/jersey

FormDataBodyPart type handling inconsistency

Open
#3,470 3 comments 0 reactions 0 assignees View on GitHub
Priority: Major Type: Bug
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

I think that the type handling in com.sun.jersey.multipart.FormDataBodyPart is inconsistent. We noticed this issue with jersey-multipart-1.16.0.jar but it still exists in 1.19.

We noticed the issue with "Content-Type: text/plain; charset=US-ASCII" as compared to "Content-Type: text/plain".

The issue is related to the comparisons against MediaType.TEXT_PLAIN_TYPE. In 2 places it is a direct comparison: setValue() and isSimple(). In the other location it is a clever comparison: getValue().

I think it would be better if isSimple() was coded as:

public boolean isSimple()

{ return MediaTypes.typeEquals(MediaType.TEXT_PLAIN_TYPE, getMediaType()); }

and that setValue() and getValue() used the isSimple() method.
#### Affected Versions
[1.19.2]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.