checkstyle fixes.

Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
This commit is contained in:
olivier lamy 2019-08-23 13:09:15 +10:00
parent 80d513e979
commit cf592469aa
10 changed files with 38 additions and 39 deletions

View File

@ -107,18 +107,18 @@ public class WriteTimeoutTest
@ServerEndpoint("/logSocket")
public static class LoggingSocket
{
private final Logger LOG = Log.getLogger(LoggingSocket.class);
private final Logger log = Log.getLogger(LoggingSocket.class);
@OnMessage
public void onMessage(String msg)
{
LOG.debug("onMessage(): {}", msg);
log.debug("onMessage(): {}", msg);
}
@OnError
public void onError(Throwable t)
{
LOG.debug("onError(): {}", t);
log.debug("onError(): {}", t);
}
}
}

View File

@ -30,7 +30,7 @@ import javax.websocket.EndpointConfig;
*/
public class TimeEncoder implements Encoder.Text<Date>
{
private TimeZone GMT = TimeZone.getTimeZone("GMT");
private static final TimeZone GMT = TimeZone.getTimeZone("GMT");
@Override
public String encode(Date object) throws EncodeException

View File

@ -324,14 +324,14 @@ public class PrimitivesTextEchoTest
addCase(data, LongEchoSocket.class, Long.toString(0), "0");
addCase(data, LongEchoSocket.class, Long.toString(100_000), "100000");
addCase(data, LongEchoSocket.class, Long.toString(-2_000_000), "-2000000");
addCase(data, LongEchoSocket.class, Long.toString(300_000_000_000l), "300000000000");
addCase(data, LongEchoSocket.class, Long.toString(300_000_000_000L), "300000000000");
addCase(data, LongEchoSocket.class, Long.toString(Long.MAX_VALUE), Long.toString(Long.MAX_VALUE));
addCase(data, LongEchoSocket.class, Long.toString(Long.MIN_VALUE), Long.toString(Long.MIN_VALUE));
addCase(data, LongObjEchoSocket.class, Long.toString(0), "0");
addCase(data, LongObjEchoSocket.class, Long.toString(100_000), "100000");
addCase(data, LongObjEchoSocket.class, Long.toString(-2_000_000), "-2000000");
addCase(data, LongObjEchoSocket.class, Long.toString(300_000_000_000l), "300000000000");
addCase(data, LongObjEchoSocket.class, Long.toString(300_000_000_000L), "300000000000");
addCase(data, LongObjEchoSocket.class, Long.toString(Long.MAX_VALUE), Long.toString(Long.MAX_VALUE));
addCase(data, LongObjEchoSocket.class, Long.toString(Long.MIN_VALUE), Long.toString(Long.MIN_VALUE));

View File

@ -98,7 +98,7 @@ public class ParserTest
* From Autobahn WebSocket Server Testcase 1.2.2
*/
@Test
public void testParse_Binary_125BytePayload() throws InterruptedException
public void testParseBinary125BytePayload() throws InterruptedException
{
int length = 125;
@ -128,7 +128,7 @@ public class ParserTest
* From Autobahn WebSocket Server Testcase 1.2.3
*/
@Test
public void testParse_Binary_126BytePayload() throws InterruptedException
public void testParseBinary126BytePayload() throws InterruptedException
{
int length = 126;
@ -161,7 +161,7 @@ public class ParserTest
* From Autobahn WebSocket Server Testcase 1.2.4
*/
@Test
public void testParse_Binary_127BytePayload() throws InterruptedException
public void testParseBinary127BytePayload() throws InterruptedException
{
int length = 127;
@ -193,7 +193,7 @@ public class ParserTest
* From Autobahn WebSocket Server Testcase 1.2.5
*/
@Test
public void testParse_Binary_128BytePayload() throws InterruptedException
public void testParseBinary128BytePayload() throws InterruptedException
{
int length = 128;
@ -225,7 +225,7 @@ public class ParserTest
* From Autobahn WebSocket Server Testcase 1.2.6
*/
@Test
public void testParse_Binary_65535BytePayload() throws InterruptedException
public void testParseBinary65535BytePayload() throws InterruptedException
{
int length = 65535;
@ -257,7 +257,7 @@ public class ParserTest
* From Autobahn WebSocket Server Testcase 1.2.7
*/
@Test
public void testParse_Binary_65536BytePayload() throws InterruptedException
public void testParseBinary65536BytePayload() throws InterruptedException
{
int length = 65536;

View File

@ -39,7 +39,7 @@ public class RawFrameBuilder
buf.put(b);
}
public static void putLengthAndMask(ByteBuffer buf, int length, byte mask[])
public static void putLengthAndMask(ByteBuffer buf, int length, byte[] mask)
{
if (mask != null)
{
@ -53,7 +53,7 @@ public class RawFrameBuilder
}
}
public static void mask(final byte[] data, final byte mask[])
public static void mask(final byte[] data, final byte[] mask)
{
assertThat("Mask.length", mask.length, is(4));
int len = data.length;
@ -96,7 +96,7 @@ public class RawFrameBuilder
}
}
public static void putMask(ByteBuffer buf, byte mask[])
public static void putMask(ByteBuffer buf, byte[] mask)
{
assertThat("Mask.length", mask.length, is(4));
buf.put(mask);

View File

@ -76,7 +76,7 @@ public class TestAsyncFrameHandler implements FrameHandler
@Override
public void onError(Throwable cause, Callback callback)
{
LOG.info("[{}] onError {} ", name, cause == null?null:cause.toString());
LOG.info("[{}] onError {} ", name, cause == null ? null : cause.toString());
error = cause;
errorLatch.countDown();
callback.succeeded();

View File

@ -29,7 +29,7 @@ import org.eclipse.jetty.util.log.Logger;
public class TestMessageHandler extends MessageHandler
{
protected final Logger LOG = Log.getLogger(TestMessageHandler.class);
protected static final Logger LOG = Log.getLogger(TestMessageHandler.class);
public CoreSession coreSession;
public BlockingQueue<String> textMessages = new BlockingArrayQueue<>();

View File

@ -79,7 +79,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
* Section 8.2.3.1: A message compressed using 1 compressed DEFLATE block
*/
@Test
public void testDraft21_Hello_UnCompressedBlock()
public void testDraft21HelloUnCompressedBlock()
{
ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate");
@ -100,7 +100,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
* Section 8.2.3.1: A message compressed using 1 compressed DEFLATE block (with fragmentation)
*/
@Test
public void testDraft21_Hello_UnCompressedBlock_Fragmented()
public void testDraft21HelloUnCompressedBlockFragmented()
{
ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate");
@ -123,7 +123,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
* Section 8.2.3.2: Sharing LZ77 Sliding Window
*/
@Test
public void testDraft21_SharingL77SlidingWindow_ContextTakeover()
public void testDraft21SharingL77SlidingWindowContextTakeover()
{
ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate");
@ -146,7 +146,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
* Section 8.2.3.2: Sharing LZ77 Sliding Window
*/
@Test
public void testDraft21_SharingL77SlidingWindow_NoContextTakeover()
public void testDraft21SharingL77SlidingWindowNoContextTakeover()
{
ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate");
@ -170,7 +170,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
* Section 8.2.3.3: Using a DEFLATE Block with No Compression
*/
@Test
public void testDraft21_DeflateBlockWithNoCompression()
public void testDraft21DeflateBlockWithNoCompression()
{
ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate");
@ -189,7 +189,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
* Section 8.2.3.4: Using a DEFLATE Block with BFINAL Set to 1
*/
@Test
public void testDraft21_DeflateBlockWithBFinal1()
public void testDraft21DeflateBlockWithBFinal1()
{
ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate");
@ -209,7 +209,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
* Section 8.2.3.5: Two DEFLATE Blocks in 1 Message
*/
@Test
public void testDraft21_TwoDeflateBlocksOneMessage()
public void testDraft21TwoDeflateBlocksOneMessage()
{
ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate");
@ -227,7 +227,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
* Decode fragmented message (3 parts: TEXT, CONTINUATION, CONTINUATION)
*/
@Test
public void testParseFragmentedMessage_Good()
public void testParseFragmentedMessageGood()
{
ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate");
@ -256,7 +256,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
* </p>
*/
@Test
public void testParseFragmentedMessage_BadRsv1()
public void testParseFragmentedMessageBadRsv1()
{
ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate");
@ -489,7 +489,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
}
@Test
public void testPyWebSocket_Client_NoContextTakeover_ThreeOra()
public void testPyWebSocketClientNoContextTakeoverThreeOra()
{
ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate; client_max_window_bits; client_no_context_takeover");
@ -497,7 +497,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
// Captured from Pywebsocket (r790) - 3 messages with similar parts.
tester.parseIncomingHex( // context takeover (3 messages)
tester.parseIncomingHex(// context takeover (3 messages)
"c1 09 0a c9 2f 4a 0c 01 62 00 00", // ToraTora
"c1 0b 72 2c c9 2f 4a 74 cb 01 12 00 00", // AtoraFlora
"c1 0b 0a c8 c8 c9 2f 4a 0c 01 62 00 00" // PhloraTora
@ -507,7 +507,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
}
@Test
public void testPyWebSocket_Client_ToraToraTora()
public void testPyWebSocketClientToraToraTora()
{
ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate; client_max_window_bits");
@ -525,7 +525,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
}
@Test
public void testPyWebSocket_Server_NoContextTakeover_ThreeOra()
public void testPyWebSocketServerNoContextTakeoverThreeOra()
{
ExtensionTool.Tester tester = serverExtensions.newTester("permessage-deflate; client_max_window_bits; client_no_context_takeover");
@ -533,7 +533,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
// Captured from Pywebsocket (r790) - 3 messages with similar parts.
tester.parseIncomingHex( // context takeover (3 messages)
tester.parseIncomingHex(// context takeover (3 messages)
"c1 89 88 bc 1b b1 82 75 34 fb 84 bd 79 b1 88", // ToraTora
"c1 8b 50 86 88 b2 22 aa 41 9d 1a f2 43 b3 42 86 88", // AtoraFlora
"c1 8b e2 3e 05 53 e8 f6 cd 9a cd 74 09 52 80 3e 05" // PhloraTora
@ -543,7 +543,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
}
@Test
public void testPyWebSocket_Server_ToraToraTora()
public void testPyWebSocketServerToraToraTora()
{
ExtensionTool.Tester tester = serverExtensions.newTester("permessage-deflate; client_max_window_bits");
@ -551,7 +551,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
// Captured from Pywebsocket (r790) - "tora" sent 3 times.
tester.parseIncomingHex( // context takeover (3 messages)
tester.parseIncomingHex(// context takeover (3 messages)
"c1 86 69 39 fe 91 43 f0 d1 db 6d 39", // tora 1
"c1 85 2d f3 eb 96 07 f2 89 96 2d", // tora 2
"c1 84 53 ad a5 34 51 cc a5 34" // tora 3

View File

@ -188,7 +188,7 @@ class WebSocketProxy
// the callback is saved until a close response comes in sendFrame from Server2Proxy
// if the callback was completed here then core would send its own close response
closeCallback = callback;
sendCallback = Callback.from(()->{}, callback::failed);
sendCallback = Callback.from(() -> {}, callback::failed);
}
break;
@ -383,7 +383,7 @@ class WebSocketProxy
try
{
state = State.CONNECTING;
client.connect(this, serverUri).whenComplete((s,t)->
client.connect(this, serverUri).whenComplete((s,t) ->
{
if (t != null)
onConnectFailure(t, callback);
@ -526,7 +526,7 @@ class WebSocketProxy
{
state = State.ISHUT;
closeCallback = callback;
sendCallback = Callback.from(()->{}, callback::failed);
sendCallback = Callback.from(() -> {}, callback::failed);
}
break;
@ -686,4 +686,4 @@ class WebSocketProxy
return "Server2Proxy:" + getState();
}
}
}
}

View File

@ -221,7 +221,6 @@ public class WebSocketProxyTest
assertThat(closeStatus.getReason(), containsString("Failed to upgrade to websocket: Unexpected HTTP Response Status Code:"));
}
@Test
public void testClientError() throws Exception
{
@ -241,7 +240,7 @@ public class WebSocketProxyTest
ClientUpgradeRequest upgradeRequest = ClientUpgradeRequest.from(_client, new URI("ws://localhost:8080/proxy/"), clientFrameHandler);
upgradeRequest.setConfiguration(defaultCustomizer);
CompletableFuture<CoreSession> response = _client.connect(upgradeRequest);
Exception e = assertThrows(ExecutionException.class, ()->response.get(5, TimeUnit.SECONDS));
Exception e = assertThrows(ExecutionException.class, () -> response.get(5, TimeUnit.SECONDS));
assertThat(e.getMessage(), containsString("simulated client onOpen error"));
assertTrue(clientFrameHandler.closeLatch.await(5, TimeUnit.SECONDS));
assertTrue(serverFrameHandler.closeLatch.await(5, TimeUnit.SECONDS));