8166604: nio: remove unneeded locals variables and correct NPE
Reviewed-by: alanb
--- 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();