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

DnsNameResolver.resolve*(...) never notifies the Future when empty ho… #6258

Closed
wants to merge 1 commit into
base: 4.1
from

Conversation

Projects
None yet
4 participants
@normanmaurer
Member

normanmaurer commented Jan 20, 2017

…stname is used.

Motivation:

When an empty hostname is used in DnsNameResolver.resolve*(...) it will never notify the future / promise. The root cause is that we not correctly guard against errors of IDN.toASCII(...) which will throw an IllegalArgumentException when it can not parse its input. That said we should also handle an empty hostname the same way as the JDK does and just use "localhost" when this happens.

Modifications:

  • If the try to resolve an empty hostname we use localhost
  • Correctly guard against errors raised by IDN.toASCII(...) so we will always noify the future / promise
  • Add unit test.

Result:

DnsNameResolver.resolve*(...) will always notify the future.

@trustin

LGTM with a few nits.

@normanmaurer

This comment has been minimized.

Show comment
Hide comment
@normanmaurer

normanmaurer Jan 21, 2017

Member

@Scottmitch PTAL again... This was the only way I could find without introduce some sort of API breaking in non @UnstableApi marked stuff.

Member

normanmaurer commented Jan 21, 2017

@Scottmitch PTAL again... This was the only way I could find without introduce some sort of API breaking in non @UnstableApi marked stuff.

DnsNameResolver.resolve*(...) never notifies the Future when empty ho…
…stname is used.

Motivation:

When an empty hostname is used in DnsNameResolver.resolve*(...) it will never notify the future / promise. The root cause is that we not correctly guard against errors of IDN.toASCII(...) which will throw an IllegalArgumentException when it can not parse its input. That said we should also handle an empty hostname the same way as the JDK does and just use "localhost" when this happens.

Modifications:

- If the try to resolve an empty hostname we use localhost
- Correctly guard against errors raised by IDN.toASCII(...) so we will always noify the future / promise
- Add unit test.

Result:

DnsNameResolver.resolve*(...) will always notify the future.
@normanmaurer

This comment has been minimized.

Show comment
Hide comment
@normanmaurer

normanmaurer Jan 24, 2017

Member

Cherry-picked into 4.1 (a416b79)

Member

normanmaurer commented Jan 24, 2017

Cherry-picked into 4.1 (a416b79)

@normanmaurer normanmaurer deleted the dns_empty_resolve branch Jan 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment