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 read() in WolfSSLInputStream to reflect end of stream #195

Merged
merged 2 commits into from
May 22, 2024

Conversation

sstefonic
Copy link
Contributor

Calling the read() method (with no parameters) on a WolfSSLInputStream will now reflect the end of a stream in the return value. If the end of the stream has been reached, -1 should be returned instead of a byte (as noted here: https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html#read-- ).

@sstefonic sstefonic assigned sstefonic and cconlon and unassigned sstefonic May 21, 2024
@@ -2383,7 +2383,12 @@ public synchronized int read() throws IOException {
byte[] data = new byte[1];

try {
this.read(data, 0, 1);
int ret = this.read(data, 0, 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you declare int ret; at the top of the method, above byte[] data = new byte[1]? That will make us consistent in putting variable declarations at the top of the method in most cases.

@cconlon cconlon assigned sstefonic and unassigned cconlon May 22, 2024
@sstefonic sstefonic assigned cconlon and unassigned sstefonic May 22, 2024
@cconlon cconlon merged commit 37cf4dc into wolfSSL:master May 22, 2024
35 checks passed
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.

2 participants