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 #2137: Two defects in j.n.PlainSocketImpl#read #2140

Conversation

LeeTibbert
Copy link
Contributor

We correct two defects in the read method for java.net.PlainSocketImpl.

We correct two defects in the read method for java.net.PlainSocketImpl.
Copy link
Member

@ekrich ekrich left a comment

Choose a reason for hiding this comment

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

I think this would look better if you just throw from the if and else branches.

@LeeTibbert
Copy link
Contributor Author

@ekrich Thank you for the review & suggestion. Both lead to the improvement of this submission.

@WojciechMazur WojciechMazur merged commit 3121e73 into scala-native:master Feb 4, 2021
bytesNum match {
case _ if (bytesNum > 0) => bytesNum

case _ if (bytesNum == 0) => if (count == 0) 0 else -1
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
case _ if (bytesNum == 0) => if (count == 0) 0 else -1
case 0 => if (count == 0) 0 else -1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lolgab Thank you for the simplification. I read this after this PR had been merged, so I created
PR #2149. This code will be around for a long time and no sense letting an eyesore endure.

ekrich pushed a commit to ekrich/scala-native that referenced this pull request May 21, 2021
…-native#2140)

* Fix scala-native#2137: Two defects in j.n.PlainSocketImpl#read

We correct two defects in the read method for java.net.PlainSocketImpl.

* Incorporate review comment.
WojciechMazur pushed a commit to WojciechMazur/scala-native that referenced this pull request Aug 25, 2021
…-native#2140)

* Fix scala-native#2137: Two defects in j.n.PlainSocketImpl#read

We correct two defects in the read method for java.net.PlainSocketImpl.

* Incorporate review comment.
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.

None yet

4 participants