RFR: 8260428: Drop support for pre JDK 1.4 DatagramSocketImpl implementations

Vyom Tewari vtewari at openjdk.java.net
Tue Oct 12 07:13:55 UTC 2021


On Mon, 11 Oct 2021 09:42:12 GMT, Patrick Concannon <pconcannon at openjdk.org> wrote:

> Hi,
> 
> Could someone please review my changes (and CSR) to drop support for pre JDK 1.4 `DatagramSocketImpl` implementations?
> 
> These changes propose to drop support for `DatagramSocketImpls` that were compiled with JDK 1.3 or older, which do not have support for connected sockets, for peeking at received datagrams, and for joining and leaving a group at a specific interface. This support is legacy, and should be relatively safe to remove as such implementations do not compile with JDK 1.4 or newer.
> 
> Finally, with this set of proposed changes, if you have an `oldImpl`, and don’t use connect, then the methods `joinGroup` and `leaveGroup` will throw `NoSuchMethodError`.  However, the current behaviour in `DatagramSocketImpl` is to throw an `UnsupportedOperationsException` for a method not implemented. Should this set of changes update the `joinGroup` and `leaveGroup` methods in order to preserve this behaviour?
> 
> CSR: https://bugs.openjdk.java.net/browse/JDK-8274633
> 
> Kind regards,
> 
> Patrick

src/java.base/share/classes/java/net/NetMulticastSocket.java line 346:

> 344:                         // peek at the packet to see who it is from.
> 345:                         DatagramPacket peekPacket = new DatagramPacket(new byte[1], 1);
> 346:                         peekPort = getImpl().peekData(peekPacket);

Is it possible for you to combine the variable declaration and assignment as follows ?. This will increase the code readability little bit. 

 int peekPort = getImpl().peekData(peekPacket);
 String peekAd = peekPacket.getAddress().getHostAddress();

src/java.base/share/classes/java/net/NetMulticastSocket.java line 383:

> 381:                     // peek at the packet to see who it is from.
> 382:                     DatagramPacket peekPacket = new DatagramPacket(new byte[1], 1);
> 383:                     peekPort = getImpl().peekData(peekPacket);

same as previous comment.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5887


More information about the net-dev mailing list