Skip to content

DelegatingServletInputStream#available always returns 0 [SPR-16416] #20962

@spring-projects-issues

Description

@spring-projects-issues

Ketan Padegaonkar opened SPR-16416 and commented

InputStream#available() is expected to answer the remaining number of bytes that can be read without blocking. The default implementation returns a 0, but subclasses may override it.

The DelegatingServletInputStream which delegates to a ByteArrayOutputStream would be expected to delegate this call to the stream it wraps over, instead of delegating to the superclass and return a 0.

I can submit a PR on github with this implementation if it's allright with the core team:

public class DelegatingServletInputStream extends ServletInputStream {
...
	@Override
	public int available() throws IOException {
		return this.sourceStream.available();
	}
...
}

Affects: 5.0.3

Referenced from: pull request #1652

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions