[RFR] 8224645: Test java/nio/channels/DatagramChannel/BasicMulticastTests.java fails with NoSuchElementException

Arthur Eubanks aeubanks at google.com
Tue May 28 17:27:07 UTC 2019


>
> Might be a bit more readable if you rename "multicasts" to
> "multicastInterfaces" but otherwise looks okay to me.

Done.


> Hi Arthur,
>
> I would suggest three things:
>
> 1. replace `if (....hasNext()) {` with `while (....hasNext()) {`
> 2. add a counter, and increment it at the end of the `while` block
>     to count how many interfaces where successfully tested
> 3. In the end, just before exiting main, check the value of
>     the counter with something like:
>
>
> ```
>          if (count == 1) {
>              System.out.println("Tested only " + count
>                             + " multicast interface");
>          } else if (count > 1) {
>              System.out.println("Tested " + count
>                             + " multicast interfaces");
>          } else {
>              NetworkConfiguration.printSystemConfiguration(System.err);
>              throw new SkippedException(
>                        "No multicast interfaces found!");
>          }
> ```
>
> best regards,
>
> -- daniel
>
Done.

new webrev: http://cr.openjdk.java.net/~aeubanks/8224645/webrev.01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190528/a906bd57/attachment.html>


More information about the nio-dev mailing list