RESTEasy used `InputStream.available()` to determine if it had completed reading an input stream from a client.
RESTEasy would sometimes fail to completely read input data from clients.
This is expected to be resolved in a future release of the product.
Description of problem:
DataSourceProvider that comes with RESTeasy is using the method InputStream::available method, which shouldn't be used as it is mention on InputStream's Javadoc:
" Note that while some implementations of InputStream will return the total number of bytes in the stream, many will not. It is never correct to use the return value of this method to allocate a buffer intended to hold all data in this stream."
Customers have mention that they are experiencing issues when using this provider
The solution would be avoid the usage of InputStream::available method.
Kyle Lape <firstname.lastname@example.org> updated the status of jira RESTEASY-779 to Resolved
Changed from Bug Fix to Known Issue to fix Bug 1097118.
master:resteasy-prod weinanli$ git branch
master:resteasy-prod weinanli$ git status
On branch 2.3.8.SP1-redhat-1
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: jaxrs-api/src/main/java/javax/ws/rs/core/NoContentException.java
new file: resteasy-jaxrs/src/main/java/org/jboss/resteasy/util/NoContent.java
new file: resteasy-jaxrs/src/main/java/org/jboss/resteasy/util/NoContentInputStreamDelegate.java
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
Patch borrowed from upstream: https://github.com/resteasy/Resteasy/pull/497/files
### NOTE ###
Please note we need to add a new class in 'jaxrs-api' from JAX-RS 2.0 spec: NoContentException.java
As EAP6 doesn't use the 'jaxrs-api' inside RESTEasy and build a standalone spec jar:
master:jboss-eap-6.3 weinanli$ find . | grep jaxrs-api
It needs to be added into that jar for this patch to work. Or resteasy will fail to work on EAP6.
Blocked by BZ1119409.
Mark, please decide whether we can put this in EAP 6.3.1 or not. If as Fernando said the jax-rs spec 1.1 can't be modified, then we should defer this issue to RESTEasy 3.x + EAP7.
Verified in 6.3.1.CP.CR1. Reproduced with org.jboss.resteasy.plugins.providers.DataSourceProviderTest.
Alessio Soldano <email@example.com> updated the status of jira RESTEASY-779 to Closed