Merge pull request #97 from bgrozev/minor-changes

Minor changes: fixes typos and removes duplicated code
This commit is contained in:
Дамян Минков 2017-04-11 10:58:47 -05:00 committed by GitHub
commit b3c304146b
5 changed files with 17 additions and 34 deletions

View File

@ -140,7 +140,7 @@ public class HttpDemuxFilter
{
byte[] buf = p.getData();
int off = p.getOffset();
// The first bytes of HTTP, SSL v2, and TCP are different so quickly
// The first bytes of HTTP, SSL v2, and TLS are different so quickly
// determine which one of the three is possible and, respectively,
// which two of the three are impossible.
int b0 = 0xFF & buf[off];
@ -199,7 +199,7 @@ public class HttpDemuxFilter
}
}
}
// Only one of HTTP, SSL v2, and TCP was deemed possible by
// Only one of HTTP, SSL v2, and TLS was deemed possible by
// looking at the first byte. If p didn't look like HTTP here,
// then it will not look like SSL v2 or TLS.
return accept;
@ -230,7 +230,7 @@ public class HttpDemuxFilter
accept = true;
}
}
// Only one of HTTP, SSL v2, and TCP was deemed possible by
// Only one of HTTP, SSL v2, and TLS was deemed possible by
// looking at the first byte. If p didn't look like TLS here,
// then it will not look like HTTP or SSL v2.
return accept;
@ -268,7 +268,7 @@ public class HttpDemuxFilter
accept = !equals;
}
}
// Only one of HTTP, SSL v2, and TCP was deemed possible by
// Only one of HTTP, SSL v2, and TLS was deemed possible by
// looking at the first byte. If p didn't look like SSL v2 here,
// then it will not look like HTTP or TLS.
return accept;

View File

@ -19,6 +19,8 @@ package org.ice4j.socket.jdk8;
import java.io.*;
import java.net.*;
import java.util.*;
import org.ice4j.socket.*;
/**
@ -48,7 +50,7 @@ class MuxServerSocket
throws IOException
{
super(
MuxServerSocketChannel.assertIsNotNull(delegate, "delegate"),
MuxServerSocketChannel.assertIsNotNull(channel, "channel"));
Objects.requireNonNull(delegate, "delegate"),
Objects.requireNonNull(channel, "channel"));
}
}

View File

@ -32,27 +32,6 @@ import org.ice4j.socket.*;
public class MuxServerSocketChannel
extends DelegatingServerSocketChannel<MuxingServerSocketChannel>
{
/**
* Asserts that <tt>t</tt> is not <tt>null</tt> by throwing a
* <tt>NullPointerException</tt> if it is.
*
* @param t the <tt>Object</tt> to assert that it is not <tt>null</tt>
* @param message the (detail) message of the <tt>NullPointerException</tt>
* to be thrown if <tt>t</tt> is <tt>null</tt>
* @param <T> the type of <tt>t</tt>
* @return <tt>t</tt>
* @throws NullPointerException if <tt>t</tt> is <tt>null</tt>. The (detail)
* message of the <tt>NullPointerException</tt> is <tt>message</tt>
*/
public static <T> T assertIsNotNull(T t, String message)
throws NullPointerException
{
if (t == null)
throw new NullPointerException(message);
else
return t;
}
/**
* Opens and binds a new {@code MuxServerSocketChannel} instance. If there
* are other (existing) {@code MuxServerSocketChannel} open and bound on the
@ -128,9 +107,9 @@ public class MuxServerSocketChannel
MuxingServerSocketChannel delegate,
DatagramPacketFilter filter)
{
super(assertIsNotNull(delegate, "delegate"));
super(Objects.requireNonNull(delegate, "delegate"));
this.filter = assertIsNotNull(filter, "filter");
this.filter = Objects.requireNonNull(filter, "filter");
}
/**

View File

@ -19,6 +19,8 @@ package org.ice4j.socket.jdk8;
import java.io.*;
import java.net.*;
import java.util.*;
import org.ice4j.socket.*;
/**
@ -48,7 +50,7 @@ class MuxingServerSocket
throws IOException
{
super(
MuxServerSocketChannel.assertIsNotNull(delegate, "delegate"),
MuxServerSocketChannel.assertIsNotNull(channel, "channel"));
Objects.requireNonNull(delegate, "delegate"),
Objects.requireNonNull(channel, "channel"));
}
}

View File

@ -281,7 +281,7 @@ class MuxingServerSocketChannel
// as possible though because it does not make sense to bind a
// ServerSocketChannel and initialize a new MuxingServerSocketChannel
// instance otherwise.
MuxServerSocketChannel.assertIsNotNull(filter, "filter");
Objects.requireNonNull(filter, "filter");
MuxingServerSocketChannel muxingChannel;
@ -641,7 +641,7 @@ class MuxingServerSocketChannel
public MuxingServerSocketChannel(ServerSocketChannel delegate)
throws IOException
{
super(MuxServerSocketChannel.assertIsNotNull(delegate, "delegate"));
super(Objects.requireNonNull(delegate, "delegate"));
// If at least one MuxServerSocketChannel is configured as non-blocking,
// then MuxingServerSocketChannel (i.e. delegate) has to be configured
@ -732,7 +732,7 @@ class MuxingServerSocketChannel
// MuxServerSocketChannels) have no priorities. It cannot be a catch all
// because a SocketChannel (i.e. Socket) may be accepted by a single
// MuxServerSocketChannel only.
MuxServerSocketChannel.assertIsNotNull(filter, "filter");
Objects.requireNonNull(filter, "filter");
MuxServerSocketChannel channel;