channel().localAddress() not always return an InetSocketAddress#330
Open
fbacchella wants to merge 1 commit into
Open
channel().localAddress() not always return an InetSocketAddress#330fbacchella wants to merge 1 commit into
fbacchella wants to merge 1 commit into
Conversation
Contributor
Author
|
Travis failed only for jruby 1.7.27. All others succeeded. Is that something related to this PR or more generic . |
4ac6c49 to
13374df
Compare
robbavey
reviewed
Jul 2, 2018
robbavey
left a comment
Member
There was a problem hiding this comment.
Minor comment on code duplication and a spacing nitpick. Other than that, this looks great - thanks for the contribution!
| SocketAddress local = context.channel().localAddress(); | ||
| SocketAddress remote = context.channel().remoteAddress(); | ||
|
|
||
| String localhost ; |
Member
There was a problem hiding this comment.
NIT: unnecessary space before ;
| if (local instanceof InetSocketAddress) { | ||
| InetSocketAddress inetlocal = (InetSocketAddress)local; | ||
| localhost = inetlocal.getAddress().getHostAddress() + ":" + inetlocal.getPort(); | ||
| } else { |
Member
There was a problem hiding this comment.
Could you refactor this to remove the code duplication?
13374df to
8600bf9
Compare
Contributor
Author
|
$ rvm use jruby-9.1.13.0 --install --binary --fuzzy The travis failure is not mine. |
8600bf9 to
71464c6
Compare
71464c6 to
0306426
Compare
…example during unit tests. So check they are the right type before type cast.
0306426 to
29fc4ea
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
channel().localAddress() not always return an InetSocketAddress, for example during unit tests.
So check they are the right type before type cast.
It must be merged before PR #329.