From b754c4b6ab0672c3f54babfff2b4726ccb99db0c Mon Sep 17 00:00:00 2001 From: sta Date: Wed, 16 Aug 2017 15:25:29 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Server/WebSocketSessionManager.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/websocket-sharp/Server/WebSocketSessionManager.cs b/websocket-sharp/Server/WebSocketSessionManager.cs index b2d9e010..8a616a8e 100644 --- a/websocket-sharp/Server/WebSocketSessionManager.cs +++ b/websocket-sharp/Server/WebSocketSessionManager.cs @@ -712,11 +712,15 @@ namespace WebSocketSharp.Server if (stream == null) throw new ArgumentNullException ("stream"); - if (!stream.CanRead) - throw new ArgumentException ("It cannot be read.", "stream"); + if (!stream.CanRead) { + var msg = "It cannot be read."; + throw new ArgumentException (msg, "stream"); + } - if (length < 1) - throw new ArgumentException ("Less than 1.", "length"); + if (length < 1) { + var msg = "Less than 1."; + throw new ArgumentException (msg, "length"); + } var bytes = stream.ReadBytes (length); @@ -729,7 +733,7 @@ namespace WebSocketSharp.Server if (len < length) { _logger.Warn ( String.Format ( - "Only {0} byte(s) of data could be read from the specified stream.", + "Only {0} byte(s) of data could be read from the stream.", len ) );