JDK-8268662 : Mistake in JavaDocs 16 - MulticastSocket
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 8,11,16,17
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2021-06-10
  • Updated: 2021-06-14
  • Resolved: 2021-06-14
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE PROBLEM :
The documentation for the MutlicastSocket says a DatagramPacket can be created like this:
 DatagramPacket hi = new DatagramPacket(msgBytes, msgBytes.length,
                                        group, 6789);
But the DatagramPacket doesn't have a constructor like this.
The code should be something like this:
DatagramPacket hi = new DatagramPacket(msgBytes, msgBytes.length,
                                        group);

A second but not mandatory improvment would be to replace the variable port with 6789, like it is done in all other lines.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Go to:
https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/net/MulticastSocket.html#leaveGroup(java.net.SocketAddress,java.net.NetworkInterface)

You should see it right at the top of see page in the guide.



Comments
This has already been fixed in JDK 17 by JDK-8263080
14-06-2021

The description mentioned in the report can be found at: https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/net/MulticastSocket.html https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/MulticastSocket.html https://docs.oracle.com/javase/8/docs/api/java/net/MulticastSocket.html
14-06-2021