eclipse-ee4j / eclipse-ee4j/jersey

Replace ReaderWriter::readAllBytes(InputStream) by InputStream::readAllBytes()

Open
#5,344 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

The source code of `ReaderWriter::readAllBytes(InputStream)` is a copy of OpenJDK's `InputStream::readAllBytes()` with one sole change needed *solely for one large Oracle customer* (actually a workaround for a bug in a custom `InputStream` of that customer), as explained by @jansupol in the discussion at https://github.com/eclipse-ee4j/jersey/pull/5341#discussion_r1199820780:
```java
if (nread == BUFFER_SIZE) { // This differs from JDK version
break; // prevents a bug (See ReaderWriterTest)
}
```
The mere existence of this method is suboptimal in several directions:
* It stays fixed even if the JRE's method gets fixed, so no bug fixes done in the JRE will be seen in Jersey.
* It stays fixed even if the JRE's method gets enhanced, so no performance optimizations done in the JRE will be seen in Jersey.
* It is custom code based on particularly OpenJDK, so Jersey never sees any performance optimizations already exisiting in *other* JREs.

Besides that, Jersey officially is not an Oracle product anymore, but an Eclipse Foundation open source project, so IMHO it should not contain *any* customer-specific workarounds. Users, even large ones, should fix their bugs instead of further relying on workarounds in open source projects.

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.