8166604: nio: remove unneeded locals variables and correct NPE
authorclanger
Mon, 26 Sep 2016 21:24:17 +0200
changeset 41134 e0b8f9336c65
parent 41133 83066d79df39
child 41135 01650fdf3284
8166604: nio: remove unneeded locals variables and correct NPE Reviewed-by: alanb
jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java
jdk/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java
--- a/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java	Mon Sep 26 08:19:07 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java	Mon Sep 26 21:24:17 2016 +0200
@@ -328,8 +328,6 @@
     public SocketAddress receive(ByteBuffer dst) throws IOException {
         if (dst.isReadOnly())
             throw new IllegalArgumentException("Read-only buffer");
-        if (dst == null)
-            throw new NullPointerException();
         synchronized (readLock) {
             ensureOpen();
             // Socket was not bound before attempting receive
@@ -716,8 +714,6 @@
 
     @Override
     public DatagramChannel connect(SocketAddress sa) throws IOException {
-        int localPort = 0;
-
         synchronized(readLock) {
             synchronized(writeLock) {
                 synchronized (stateLock) {
--- a/jdk/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java	Mon Sep 26 08:19:07 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java	Mon Sep 26 21:24:17 2016 +0200
@@ -616,8 +616,6 @@
     }
 
     public boolean connect(SocketAddress sa) throws IOException {
-        int localPort = 0;
-
         synchronized (readLock) {
             synchronized (writeLock) {
                 ensureOpenAndUnconnected();