Merge pull request #97 from bgrozev/minor-changes
Minor changes: fixes typos and removes duplicated code
This commit is contained in:
commit
b3c304146b
@ -140,7 +140,7 @@ public class HttpDemuxFilter
|
|||||||
{
|
{
|
||||||
byte[] buf = p.getData();
|
byte[] buf = p.getData();
|
||||||
int off = p.getOffset();
|
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,
|
// determine which one of the three is possible and, respectively,
|
||||||
// which two of the three are impossible.
|
// which two of the three are impossible.
|
||||||
int b0 = 0xFF & buf[off];
|
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,
|
// looking at the first byte. If p didn't look like HTTP here,
|
||||||
// then it will not look like SSL v2 or TLS.
|
// then it will not look like SSL v2 or TLS.
|
||||||
return accept;
|
return accept;
|
||||||
@ -230,7 +230,7 @@ public class HttpDemuxFilter
|
|||||||
accept = true;
|
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,
|
// looking at the first byte. If p didn't look like TLS here,
|
||||||
// then it will not look like HTTP or SSL v2.
|
// then it will not look like HTTP or SSL v2.
|
||||||
return accept;
|
return accept;
|
||||||
@ -268,7 +268,7 @@ public class HttpDemuxFilter
|
|||||||
accept = !equals;
|
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,
|
// looking at the first byte. If p didn't look like SSL v2 here,
|
||||||
// then it will not look like HTTP or TLS.
|
// then it will not look like HTTP or TLS.
|
||||||
return accept;
|
return accept;
|
||||||
|
|||||||
@ -19,6 +19,8 @@ package org.ice4j.socket.jdk8;
|
|||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
import org.ice4j.socket.*;
|
import org.ice4j.socket.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,7 +50,7 @@ class MuxServerSocket
|
|||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
super(
|
super(
|
||||||
MuxServerSocketChannel.assertIsNotNull(delegate, "delegate"),
|
Objects.requireNonNull(delegate, "delegate"),
|
||||||
MuxServerSocketChannel.assertIsNotNull(channel, "channel"));
|
Objects.requireNonNull(channel, "channel"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,27 +32,6 @@ import org.ice4j.socket.*;
|
|||||||
public class MuxServerSocketChannel
|
public class MuxServerSocketChannel
|
||||||
extends DelegatingServerSocketChannel<MuxingServerSocketChannel>
|
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
|
* Opens and binds a new {@code MuxServerSocketChannel} instance. If there
|
||||||
* are other (existing) {@code MuxServerSocketChannel} open and bound on the
|
* are other (existing) {@code MuxServerSocketChannel} open and bound on the
|
||||||
@ -128,9 +107,9 @@ public class MuxServerSocketChannel
|
|||||||
MuxingServerSocketChannel delegate,
|
MuxingServerSocketChannel delegate,
|
||||||
DatagramPacketFilter filter)
|
DatagramPacketFilter filter)
|
||||||
{
|
{
|
||||||
super(assertIsNotNull(delegate, "delegate"));
|
super(Objects.requireNonNull(delegate, "delegate"));
|
||||||
|
|
||||||
this.filter = assertIsNotNull(filter, "filter");
|
this.filter = Objects.requireNonNull(filter, "filter");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -19,6 +19,8 @@ package org.ice4j.socket.jdk8;
|
|||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
import org.ice4j.socket.*;
|
import org.ice4j.socket.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,7 +50,7 @@ class MuxingServerSocket
|
|||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
super(
|
super(
|
||||||
MuxServerSocketChannel.assertIsNotNull(delegate, "delegate"),
|
Objects.requireNonNull(delegate, "delegate"),
|
||||||
MuxServerSocketChannel.assertIsNotNull(channel, "channel"));
|
Objects.requireNonNull(channel, "channel"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -281,7 +281,7 @@ class MuxingServerSocketChannel
|
|||||||
// as possible though because it does not make sense to bind a
|
// as possible though because it does not make sense to bind a
|
||||||
// ServerSocketChannel and initialize a new MuxingServerSocketChannel
|
// ServerSocketChannel and initialize a new MuxingServerSocketChannel
|
||||||
// instance otherwise.
|
// instance otherwise.
|
||||||
MuxServerSocketChannel.assertIsNotNull(filter, "filter");
|
Objects.requireNonNull(filter, "filter");
|
||||||
|
|
||||||
MuxingServerSocketChannel muxingChannel;
|
MuxingServerSocketChannel muxingChannel;
|
||||||
|
|
||||||
@ -641,7 +641,7 @@ class MuxingServerSocketChannel
|
|||||||
public MuxingServerSocketChannel(ServerSocketChannel delegate)
|
public MuxingServerSocketChannel(ServerSocketChannel delegate)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
super(MuxServerSocketChannel.assertIsNotNull(delegate, "delegate"));
|
super(Objects.requireNonNull(delegate, "delegate"));
|
||||||
|
|
||||||
// If at least one MuxServerSocketChannel is configured as non-blocking,
|
// If at least one MuxServerSocketChannel is configured as non-blocking,
|
||||||
// then MuxingServerSocketChannel (i.e. delegate) has to be configured
|
// 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
|
// MuxServerSocketChannels) have no priorities. It cannot be a catch all
|
||||||
// because a SocketChannel (i.e. Socket) may be accepted by a single
|
// because a SocketChannel (i.e. Socket) may be accepted by a single
|
||||||
// MuxServerSocketChannel only.
|
// MuxServerSocketChannel only.
|
||||||
MuxServerSocketChannel.assertIsNotNull(filter, "filter");
|
Objects.requireNonNull(filter, "filter");
|
||||||
|
|
||||||
MuxServerSocketChannel channel;
|
MuxServerSocketChannel channel;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user