From 087f412c18f12beef6cca1239efeb650ae2bcea2 Mon Sep 17 00:00:00 2001 From: Mirro Mutth Date: Fri, 16 Feb 2024 11:38:57 +0900 Subject: [PATCH] Polishing and fix typo --- .../io/asyncer/r2dbc/mysql/Capability.java | 6 +- .../asyncer/r2dbc/mysql/ColumnDefinition.java | 2 +- .../r2dbc/mysql/ConnectionContext.java | 4 +- .../asyncer/r2dbc/mysql/MySqlConnection.java | 10 +-- .../mysql/MySqlConnectionConfiguration.java | 55 ++++++++------- .../r2dbc/mysql/MySqlConnectionFactory.java | 2 +- .../io/asyncer/r2dbc/mysql/MySqlNames.java | 20 +++--- .../asyncer/r2dbc/mysql/MySqlParameter.java | 6 +- .../r2dbc/mysql/MySqlSslConfiguration.java | 2 +- .../asyncer/r2dbc/mysql/ParameterWriter.java | 10 +-- .../mysql/ParametrizedStatementSupport.java | 2 +- .../java/io/asyncer/r2dbc/mysql/Query.java | 2 +- .../io/asyncer/r2dbc/mysql/QueryFlow.java | 2 +- .../r2dbc/mysql/authentication/AuthUtils.java | 2 +- .../authentication/MySqlAuthProvider.java | 2 +- .../mysql/client/DefaultHostnameVerifier.java | 4 +- .../mysql/client/ReactorNettyClient.java | 2 +- .../io/asyncer/r2dbc/mysql/codec/Codec.java | 10 +-- .../io/asyncer/r2dbc/mysql/codec/Codecs.java | 5 +- .../asyncer/r2dbc/mysql/codec/DateTimes.java | 2 +- .../r2dbc/mysql/codec/DefaultCodecs.java | 14 ++-- .../r2dbc/mysql/codec/ParametrizedCodec.java | 6 +- .../r2dbc/mysql/codec/PrimitiveCodec.java | 8 +-- .../r2dbc/mysql/collation/CharsetTarget.java | 2 +- .../mysql/constant/ColumnDefinitions.java | 69 ------------------- .../r2dbc/mysql/constant/MySqlType.java | 11 ++- .../mysql/internal/util/FluxEnvelope.java | 4 +- .../mysql/internal/util/VarIntUtils.java | 2 +- .../r2dbc/mysql/message/FieldValue.java | 6 +- .../r2dbc/mysql/message/LargeFieldValue.java | 2 +- .../message/client/HandshakeResponse41.java | 2 +- .../mysql/message/client/ParamWriter.java | 4 +- .../mysql/message/server/Eof320Message.java | 2 +- .../mysql/message/server/Eof41Message.java | 2 +- .../message/server/HandshakeRequest.java | 10 +-- .../message/server/LargeFieldReader.java | 2 +- .../server/PrepareQueryDecodeContext.java | 2 +- .../message/server/ServerMessageDecoder.java | 8 +-- .../PrepareParametrizedStatementTest.java | 3 +- .../mysql/QueryIntegrationTestSupport.java | 1 - .../mysql/TextParametrizedStatementTest.java | 3 +- .../mysql/client/ZlibCompressorTest.java | 2 - .../asyncer/r2dbc/mysql/codec/CodecsTest.java | 3 +- 43 files changed, 115 insertions(+), 203 deletions(-) delete mode 100644 src/main/java/io/asyncer/r2dbc/mysql/constant/ColumnDefinitions.java diff --git a/src/main/java/io/asyncer/r2dbc/mysql/Capability.java b/src/main/java/io/asyncer/r2dbc/mysql/Capability.java index 67ebc3711..50b965ad4 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/Capability.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/Capability.java @@ -216,9 +216,9 @@ public boolean isProtocol41() { } /** - * Checks if can use var-integer sized bytes to encode client authentication. + * Checks if allow to use var-integer sized bytes to encode client authentication. * - * @return if can use var-integer sized authentication. + * @return if allow to use var-integer sized authentication. */ public boolean isVarIntSizedAuthAllowed() { return (bitmap & VAR_INT_SIZED_AUTH) != 0; @@ -236,7 +236,7 @@ public boolean isPluginAuthAllowed() { /** * Checks if the connection contains connection attributes. * - * @return if has connection attributes. + * @return if connection attributes exists. */ public boolean isConnectionAttributesAllowed() { return (bitmap & CONNECT_ATTRS) != 0; diff --git a/src/main/java/io/asyncer/r2dbc/mysql/ColumnDefinition.java b/src/main/java/io/asyncer/r2dbc/mysql/ColumnDefinition.java index 2ab077c0c..62a565159 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/ColumnDefinition.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/ColumnDefinition.java @@ -79,7 +79,7 @@ public boolean isNotNull() { /** * Checks if value is an unsigned number. e.g. INT UNSIGNED, BIGINT UNSIGNED. *

- * Note: IEEE-754 floating types (e.g. DOUBLE/FLOAT) do not supports it in MySQL 8.0+. When creating a + * Note: IEEE-754 floating types (e.g. DOUBLE/FLOAT) do not support it in MySQL 8.0+. When creating a * column as an unsigned floating type, the server may report a warning. * * @return if value is an unsigned number. diff --git a/src/main/java/io/asyncer/r2dbc/mysql/ConnectionContext.java b/src/main/java/io/asyncer/r2dbc/mysql/ConnectionContext.java index f8f594fdc..0445ff914 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/ConnectionContext.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/ConnectionContext.java @@ -30,8 +30,8 @@ /** * The MySQL connection context considers the behavior of server or client. *

- * WARNING: Do NOT change any data outside of this project, try configure {@code ConnectionFactoryOptions} or - * {@code MySqlConnectionConfiguration} to control connection context and client behavior. + * WARNING: Do NOT change any data outside of this project, try to configure {@code ConnectionFactoryOptions} + * or {@code MySqlConnectionConfiguration} to control connection context and client behavior. */ public final class ConnectionContext implements CodecContext { diff --git a/src/main/java/io/asyncer/r2dbc/mysql/MySqlConnection.java b/src/main/java/io/asyncer/r2dbc/mysql/MySqlConnection.java index 049d351ab..199f92cf1 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/MySqlConnection.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/MySqlConnection.java @@ -618,17 +618,13 @@ private static ZoneId convertZoneId(String id) { try { switch (realId) { case "Factory": - // Looks like the "Factory" time zone is UTC. + // It seems like UTC. return ZoneOffset.UTC; case "America/Nuuk": - // They are same timezone including DST. + // America/Godthab is the same as America/Nuuk, with DST. return ZoneId.of("America/Godthab"); case "ROC": - // Republic of China, 1912-1949, very very old time zone. - // Even the ZoneId.SHORT_IDS does not support it. - // Is there anyone using this time zone, really? - // Don't think so, but should support it for compatible. - // Just use GMT+8, id is equal to +08:00. + // It is equal to +08:00. return ZoneId.of("+8"); } diff --git a/src/main/java/io/asyncer/r2dbc/mysql/MySqlConnectionConfiguration.java b/src/main/java/io/asyncer/r2dbc/mysql/MySqlConnectionConfiguration.java index fdfce2fd9..60ea6ae3b 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/MySqlConnectionConfiguration.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/MySqlConnectionConfiguration.java @@ -48,7 +48,7 @@ import static io.asyncer.r2dbc.mysql.internal.util.InternalArrays.EMPTY_STRINGS; /** - * MySQL configuration of connection. + * A configuration of MySQL connection. */ public final class MySqlConnectionConfiguration { @@ -461,7 +461,7 @@ public MySqlConnectionConfiguration build() { } /** - * Configure the database. Default no database. + * Configures the database. Default no database. * * @param database the database, or {@code null} if no database want to be login. * @return this {@link Builder}. @@ -473,7 +473,7 @@ public Builder database(@Nullable String database) { } /** - * Configure to create the database given in the configuration if it does not yet exist. Default to + * Configures to create the database given in the configuration if it does not yet exist. Default to * {@code false}. * * @param enabled to discover and register extensions. @@ -486,7 +486,7 @@ public Builder createDatabaseIfNotExist(boolean enabled) { } /** - * Configure the Unix Domain Socket to connect to. + * Configures the Unix Domain Socket to connect to. * * @param unixSocket the socket file path. * @return this {@link Builder}. @@ -500,7 +500,7 @@ public Builder unixSocket(String unixSocket) { } /** - * Configure the host. + * Configures the host. * * @param host the host. * @return this {@link Builder}. @@ -514,7 +514,7 @@ public Builder host(String host) { } /** - * Configure the password, MySQL allows to login without password. + * Configures the password. Default login without password. *

* Note: for memory security, should not use intern {@link String} for password. * @@ -528,7 +528,7 @@ public Builder password(@Nullable CharSequence password) { } /** - * Configure the port. Defaults to {@code 3306}. + * Configures the port. Defaults to {@code 3306}. * * @param port the port. * @return this {@link Builder}. @@ -543,9 +543,9 @@ public Builder port(int port) { } /** - * Configure the connection timeout. Default no timeout. + * Configures the connection timeout. Default no timeout. * - * @param connectTimeout the connection timeout, or {@code null} if has no timeout. + * @param connectTimeout the connection timeout, or {@code null} if no timeout. * @return this {@link Builder}. * @since 0.8.1 */ @@ -555,7 +555,7 @@ public Builder connectTimeout(@Nullable Duration connectTimeout) { } /** - * Set the user for login the database. + * Configures the user for login the database. * * @param user the user. * @return this {@link Builder}. @@ -580,8 +580,7 @@ public Builder username(String user) { } /** - * Enforce the time zone of server. Default to query server time zone in initialization (no - * enforce). + * Configures the time zone of server. Default to query server time zone in initialization. * * @param serverZoneId the {@link ZoneId}, or {@code null} if query in initialization. * @return this {@link Builder}. @@ -593,8 +592,8 @@ public Builder serverZoneId(@Nullable ZoneId serverZoneId) { } /** - * Configure the {@link ZeroDateOption}. It is a behavior option when this driver receives a value of - * zero-date. + * Configures the {@link ZeroDateOption}. Default to {@link ZeroDateOption#USE_NULL}. It is a + * behavior option when this driver receives a value of zero-date. * * @param zeroDate the {@link ZeroDateOption}. * @return this {@link Builder}. @@ -607,7 +606,7 @@ public Builder zeroDateOption(ZeroDateOption zeroDate) { } /** - * Configure ssl mode. See also {@link SslMode}. + * Configures ssl mode. See also {@link SslMode}. * * @param sslMode the SSL mode to use. * @return this {@link Builder}. @@ -620,7 +619,7 @@ public Builder sslMode(SslMode sslMode) { } /** - * Configure TLS versions, see {@link io.asyncer.r2dbc.mysql.constant.TlsVersions}. + * Configures TLS versions, see {@link io.asyncer.r2dbc.mysql.constant.TlsVersions TlsVersions}. * * @param tlsVersion TLS versions. * @return this {@link Builder}. @@ -643,7 +642,7 @@ public Builder tlsVersion(String... tlsVersion) { } /** - * Configure SSL {@link HostnameVerifier}, it is available only set {@link #sslMode(SslMode)} as + * Configures SSL {@link HostnameVerifier}, it is available only set {@link #sslMode(SslMode)} as * {@link SslMode#VERIFY_IDENTITY}. It is useful when server was using special Certificates or need * special verification. *

@@ -661,7 +660,7 @@ public Builder sslHostnameVerifier(HostnameVerifier sslHostnameVerifier) { } /** - * Configure SSL root certification for server certificate validation. It is only available if the + * Configures SSL root certification for server certificate validation. It is only available if the * {@link #sslMode(SslMode)} is configured for verify server certification. *

* Default is {@code null}, which means that the default algorithm is used for the trust manager. @@ -676,7 +675,7 @@ public Builder sslCa(@Nullable String sslCa) { } /** - * Configure client SSL certificate for client authentication. + * Configures client SSL certificate for client authentication. *

* The {@link #sslCert} and {@link #sslKey} must be both non-{@code null} or both {@code null}. * @@ -690,7 +689,7 @@ public Builder sslCert(@Nullable String sslCert) { } /** - * Configure client SSL key for client authentication. + * Configures client SSL key for client authentication. *

* The {@link #sslCert} and {@link #sslKey} must be both non-{@code null} or both {@code null}. * @@ -704,7 +703,7 @@ public Builder sslKey(@Nullable String sslKey) { } /** - * Configure the password of SSL key file for client certificate authentication. + * Configures the password of SSL key file for client certificate authentication. *

* It will be used only if {@link #sslKey} and {@link #sslCert} non-null. * @@ -719,7 +718,7 @@ public Builder sslKeyPassword(@Nullable CharSequence sslKeyPassword) { } /** - * Configure a {@link SslContextBuilder} customizer. The customizer gets applied on each SSL + * Configures a {@link SslContextBuilder} customizer. The customizer gets applied on each SSL * connection attempt to allow for just-in-time configuration updates. The {@link Function} gets * called with the prepared {@link SslContextBuilder} that has all configuration options applied. The * customizer may return the same builder or return a new builder instance to be used to build the SSL @@ -739,7 +738,7 @@ public Builder sslContextBuilderCustomizer( } /** - * Configure TCP KeepAlive. + * Configures TCP KeepAlive. * * @param enabled whether to enable TCP KeepAlive * @return this {@link Builder} @@ -752,7 +751,7 @@ public Builder tcpKeepAlive(boolean enabled) { } /** - * Configure TCP NoDelay. + * Configures TCP NoDelay. * * @param enabled whether to enable TCP NoDelay * @return this {@link Builder} @@ -765,7 +764,7 @@ public Builder tcpNoDelay(boolean enabled) { } /** - * Configure the protocol of parametrized statements to the text protocol. + * Configures the protocol of parametrized statements to the text protocol. *

* The text protocol is default protocol that's using client-preparing. See also MySQL * documentations. @@ -779,7 +778,7 @@ public Builder useClientPrepareStatement() { } /** - * Configure the protocol of parametrized statements to the binary protocol. + * Configures the protocol of parametrized statements to the binary protocol. *

* The binary protocol is compact protocol that's using server-preparing. See also MySQL * documentations. @@ -792,7 +791,7 @@ public Builder useServerPrepareStatement() { } /** - * Configure the protocol of parametrized statements and prepare-preferred simple statements to the + * Configures the protocol of parametrized statements and prepare-preferred simple statements to the * binary protocol. *

* The {@code preferPrepareStatement} configures whether to prefer prepare execution on a @@ -816,7 +815,7 @@ public Builder useServerPrepareStatement(Predicate preferPrepareStatemen } /** - * Configure the session variables, used to set session variables immediately after login. Default no + * Configures the session variables, used to set session variables immediately after login. Default no * session variables to set. It should be a list of key-value pairs. e.g. * {@code ["sql_mode='ANSI_QUOTES,STRICT_TRANS_TABLES'", "time_zone=00:00"]}. * diff --git a/src/main/java/io/asyncer/r2dbc/mysql/MySqlConnectionFactory.java b/src/main/java/io/asyncer/r2dbc/mysql/MySqlConnectionFactory.java index a8b49a4df..d29bdb968 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/MySqlConnectionFactory.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/MySqlConnectionFactory.java @@ -158,7 +158,7 @@ private static Mono getMySqlConnection( }) .flatMap(client -> { ByteBufAllocator allocator = client.getByteBufAllocator(); - CodecsBuilder builder = Codecs.builder(allocator); + CodecsBuilder builder = Codecs.builder(); PrepareCache prepareCache = Caches.createPrepareCache(prepareCacheSize); String db = createDbIfNotExist ? database : ""; diff --git a/src/main/java/io/asyncer/r2dbc/mysql/MySqlNames.java b/src/main/java/io/asyncer/r2dbc/mysql/MySqlNames.java index 40027ea04..29d85dfe3 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/MySqlNames.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/MySqlNames.java @@ -67,7 +67,7 @@ private static int binarySearch(String[] names, String name, boolean ignoreCase) left = middle + 1; if (compared == -2) { - // Match succeed if case insensitive, always use last + // Match succeed if case-insensitive, always use last // matched result that will be closer to `name`. ciResult = middle; } @@ -75,12 +75,12 @@ private static int binarySearch(String[] names, String name, boolean ignoreCase) right = middle - 1; if (compared == 2) { - // Match succeed if case insensitive, always use last + // Match succeed if case-insensitive, always use last // matched result that will be closer to `name`. ciResult = middle; } } else { - // Match succeed when case sensitive, just return. + // Match succeed when case-sensitive. return middle; } } @@ -90,9 +90,9 @@ private static int binarySearch(String[] names, String name, boolean ignoreCase) /** * Compares double strings and return an integer of both difference. If the integer is {@code 0} means - * both strings equals even case sensitive, absolute value is {@code 2} means it is equals by case - * insensitive but not equals when case sensitive, absolute value is {@code 4} means it is not equals even - * case insensitive. + * both strings equals even case-sensitive, absolute value is {@code 2} means it is equals by + * case-insensitive but not equals when case-sensitive, absolute value is {@code 4} means it is not equals + * even case-insensitive. *

* Note: visible for unit tests. * @@ -117,7 +117,7 @@ private static int compare0(String left, String right, int start, int end) { if (leftCh != rightCh) { if (csCompared == 0) { - // Compare end if is case sensitive comparator. + // Compare end if is case-sensitive comparator. csCompared = leftCh - rightCh; } @@ -126,18 +126,18 @@ private static int compare0(String left, String right, int start, int end) { rightCh = Character.toLowerCase(rightCh); if (leftCh != rightCh) { - // Not equals even case insensitive. + // Not equals even case-insensitive. return leftCh < rightCh ? -4 : 4; } } } - // Length not equals means both strings not equals even case insensitive. + // Length not equals means both strings not equals even case-insensitive. if (leftSize != rightSize) { return leftSize < rightSize ? -4 : 4; } - // Equals when case insensitive, use case sensitive. + // Equals when case-insensitive, use case-sensitive. return csCompared < 0 ? -2 : (csCompared > 0 ? 2 : 0); } diff --git a/src/main/java/io/asyncer/r2dbc/mysql/MySqlParameter.java b/src/main/java/io/asyncer/r2dbc/mysql/MySqlParameter.java index 08df22a4c..25088dff4 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/MySqlParameter.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/MySqlParameter.java @@ -43,7 +43,7 @@ default boolean isNull() { * Binary protocol encoding. See MySQL protocol documentations, if don't want to support the binary * protocol, please receive an exception. *

- * Note: not like the text protocol, it make a sense for state-less. + * Note: not like the text protocol, it makes a sense for state-less. *

* Binary protocol maybe need to add a var-integer length before encoded content. So if makes it like * {@code Mono publishBinary (Xxx binaryWriter)}, and if supports multiple times writing like a @@ -75,9 +75,9 @@ default boolean isNull() { Mono publishText(ParameterWriter writer); /** - * Get the {@link MySqlType} of this parameter data. + * Gets the {@link MySqlType} of this parameter data. *

- * If don't want to support the binary protocol, just throw an exception please. + * If it does not want to support the binary protocol, just throw an exception please. * * @return the MySQL type. */ diff --git a/src/main/java/io/asyncer/r2dbc/mysql/MySqlSslConfiguration.java b/src/main/java/io/asyncer/r2dbc/mysql/MySqlSslConfiguration.java index 2a4b1c0fa..d76662f40 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/MySqlSslConfiguration.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/MySqlSslConfiguration.java @@ -29,7 +29,7 @@ import static io.asyncer.r2dbc.mysql.internal.util.InternalArrays.EMPTY_STRINGS; /** - * MySQL configuration of SSL. + * A configuration of MySQL SSL connection. */ public final class MySqlSslConfiguration { diff --git a/src/main/java/io/asyncer/r2dbc/mysql/ParameterWriter.java b/src/main/java/io/asyncer/r2dbc/mysql/ParameterWriter.java index 62ac43e29..fa52a1f69 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/ParameterWriter.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/ParameterWriter.java @@ -38,7 +38,7 @@ public abstract class ParameterWriter extends Writer { /** * Writes a value of {@code int} to current parameter. If current mode is string mode, it will write as a - * string like {@code write(String.valueOf(value))}. If it write as a numeric, nothing else can be written + * string like {@code write(String.valueOf(value))}. If write as a numeric, nothing else can be written * before or after this. * * @param value the value of {@code int}. @@ -68,7 +68,7 @@ public abstract class ParameterWriter extends Writer { /** * Writes a value of {@link BigInteger} to current parameter. If current mode is string mode, it will - * write as a string like {@code write(value.toString())}. If it write as a numeric, nothing else can be + * write as a string like {@code write(value.toString())}. If write as a numeric, nothing else can be * written before or after this. * * @param value the value of {@link BigInteger}. @@ -79,7 +79,7 @@ public abstract class ParameterWriter extends Writer { /** * Writes a value of {@code float} to current parameter. If current mode is string mode, it will write as - * a string like {@code write(String.valueOf(value))}. If it write as a numeric, nothing else can be + * a string like {@code write(String.valueOf(value))}. If write as a numeric, nothing else can be * written before or after this. * * @param value the value of {@code float}. @@ -89,7 +89,7 @@ public abstract class ParameterWriter extends Writer { /** * Writes a value of {@code double} to current parameter. If current mode is string mode, it will write as - * a string like {@code write(String.valueOf(value))}. If it write as a numeric, nothing else can be + * a string like {@code write(String.valueOf(value))}. If write as a numeric, nothing else can be * written before or after this. * * @param value the value of {@code double}. @@ -99,7 +99,7 @@ public abstract class ParameterWriter extends Writer { /** * Writes a value of {@link BigDecimal} to current parameter. If current mode is string mode, it will - * write as a string like {@code write(value.toString())}. If it write as a numeric, nothing else can be + * write as a string like {@code write(value.toString())}. If write as a numeric, nothing else can be * written before or after this. * * @param value the value of {@link BigDecimal}. diff --git a/src/main/java/io/asyncer/r2dbc/mysql/ParametrizedStatementSupport.java b/src/main/java/io/asyncer/r2dbc/mysql/ParametrizedStatementSupport.java index ffe203077..98ce359e4 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/ParametrizedStatementSupport.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/ParametrizedStatementSupport.java @@ -34,7 +34,7 @@ /** * Base class considers parametrized {@link MySqlStatement} with parameter markers. *

- * MySQL uses indexed parameters which are marked by {@literal ?} without naming. Implementations should uses + * MySQL uses indexed parameters which are marked by {@literal ?} without naming. Implementations should use * {@link Query} to supports named parameters. */ abstract class ParametrizedStatementSupport extends MySqlStatementSupport { diff --git a/src/main/java/io/asyncer/r2dbc/mysql/Query.java b/src/main/java/io/asyncer/r2dbc/mysql/Query.java index 1fe94ee54..49c063e61 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/Query.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/Query.java @@ -167,7 +167,7 @@ public static Query parse(String sql) { } Map nameKeyedParams = new HashMap<>(); - // Used by singleton map, if SQL does not contains named-parameter, it will always be empty. + // Used by singleton map, if SQL does not contain named-parameter, it will always be empty. String anyName = ""; // The last parameter end index (whatever named or not) of sql. int lastParamEnd = 0; diff --git a/src/main/java/io/asyncer/r2dbc/mysql/QueryFlow.java b/src/main/java/io/asyncer/r2dbc/mysql/QueryFlow.java index 4ad301974..5efe0be34 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/QueryFlow.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/QueryFlow.java @@ -270,7 +270,7 @@ static Mono beginTransaction(Client client, ConnectionState state, boolean * * @param client the {@link Client} to exchange messages with. * @param state the connection state for checks and resets transaction statuses. - * @param commit if commit, otherwise rollback. + * @param commit if it is commit, otherwise rollback. * @param batchSupported if connection supports batch query. * @return receives complete signal. */ diff --git a/src/main/java/io/asyncer/r2dbc/mysql/authentication/AuthUtils.java b/src/main/java/io/asyncer/r2dbc/mysql/authentication/AuthUtils.java index e3a952ee6..2a9cd84e8 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/authentication/AuthUtils.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/authentication/AuthUtils.java @@ -25,7 +25,7 @@ import static io.asyncer.r2dbc.mysql.constant.Packets.TERMINAL; /** - * An utility for general authentication hashing algorithm. + * A utility for general authentication hashing algorithm. */ final class AuthUtils { diff --git a/src/main/java/io/asyncer/r2dbc/mysql/authentication/MySqlAuthProvider.java b/src/main/java/io/asyncer/r2dbc/mysql/authentication/MySqlAuthProvider.java index 41f640d0a..2ae157271 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/authentication/MySqlAuthProvider.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/authentication/MySqlAuthProvider.java @@ -68,7 +68,7 @@ public interface MySqlAuthProvider { /** * Get the built-in authentication plugin provider through the specified {@code type}. * - * @param type the type name of a authentication plugin provider + * @param type the type name of an authentication plugin provider * @return the authentication plugin provider * @throws R2dbcPermissionDeniedException the {@code type} name not found */ diff --git a/src/main/java/io/asyncer/r2dbc/mysql/client/DefaultHostnameVerifier.java b/src/main/java/io/asyncer/r2dbc/mysql/client/DefaultHostnameVerifier.java index 8b58a7547..39dc784c1 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/client/DefaultHostnameVerifier.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/client/DefaultHostnameVerifier.java @@ -124,7 +124,7 @@ private static boolean matchIpv6(String ip, List sans) { String host = normaliseIpv6(ip); for (San san : sans) { - // IP must be case sensitive. + // IP must be case-sensitive. if (San.IP == san.getType() && host.equals(normaliseIpv6(san.getValue()))) { if (LOG_DEBUG) { logger.debug("Certificate for '{}' matched IPv6 '{}' of the Subject Alternative Names", @@ -231,7 +231,7 @@ private static boolean matchHost(String host, String pattern) { int remainderIndex = host.length() - postfixSize; if (remainderIndex <= asteriskIndex) { - // Asterisk must to match least one character. + // The asterisk must match at least one character. // In other words: groups.*.example.com can not match groups..example.com return false; } diff --git a/src/main/java/io/asyncer/r2dbc/mysql/client/ReactorNettyClient.java b/src/main/java/io/asyncer/r2dbc/mysql/client/ReactorNettyClient.java index 8abf17c10..b9a12f3cc 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/client/ReactorNettyClient.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/client/ReactorNettyClient.java @@ -266,7 +266,7 @@ private static void resetSequence(Connection connection) { @Override public String toString() { return String.format("ReactorNettyClient(%s){connectionId=%d}", - isConnected() ? "activating" : "clsoing or closed", context.getConnectionId()); + isConnected() ? "activating" : "closing or closed", context.getConnectionId()); } private void emitNextRequest(ClientMessage request) { diff --git a/src/main/java/io/asyncer/r2dbc/mysql/codec/Codec.java b/src/main/java/io/asyncer/r2dbc/mysql/codec/Codec.java index daaf6b64f..eb184fc20 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/codec/Codec.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/codec/Codec.java @@ -31,7 +31,7 @@ public interface Codec { /** - * Decode a {@link ByteBuf} as specified {@link Class}. + * Decodes a {@link ByteBuf} as specified {@link Class}. * * @param value the {@link ByteBuf}. * @param metadata the metadata of the column. @@ -45,19 +45,19 @@ T decode(ByteBuf value, MySqlColumnMetadata metadata, Class target, boolean b CodecContext context); /** - * Check if can decode the field value as specified {@link Class}. + * Checks if the field value can be decoded as specified {@link Class}. * * @param metadata the metadata of the column. * @param target the specified {@link Class}. - * @return if can decode. + * @return if it can decode. */ boolean canDecode(MySqlColumnMetadata metadata, Class target); /** - * Check if can encode the specified value. + * Checks if it can encode the specified value. * * @param value the specified value. - * @return if can encode. + * @return if it can encode. */ boolean canEncode(Object value); diff --git a/src/main/java/io/asyncer/r2dbc/mysql/codec/Codecs.java b/src/main/java/io/asyncer/r2dbc/mysql/codec/Codecs.java index aff4799b0..45129a26f 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/codec/Codecs.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/codec/Codecs.java @@ -93,10 +93,9 @@ T decode(FieldValue value, MySqlColumnMetadata metadata, ParameterizedType t /** * Create a builder from a {@link ByteBufAllocator}. * - * @param allocator the {@link ByteBufAllocator}. * @return a {@link CodecsBuilder}. */ - static CodecsBuilder builder(ByteBufAllocator allocator) { - return new DefaultCodecs.Builder(allocator); + static CodecsBuilder builder() { + return new DefaultCodecs.Builder(); } } diff --git a/src/main/java/io/asyncer/r2dbc/mysql/codec/DateTimes.java b/src/main/java/io/asyncer/r2dbc/mysql/codec/DateTimes.java index 480eafa06..3d4a23e43 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/codec/DateTimes.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/codec/DateTimes.java @@ -27,7 +27,7 @@ import java.time.temporal.Temporal; /** - * An utility considers date/time generic logic for {@link Codec} implementations. + * A utility considers date/time generic logic for {@link Codec} implementations. */ final class DateTimes { diff --git a/src/main/java/io/asyncer/r2dbc/mysql/codec/DefaultCodecs.java b/src/main/java/io/asyncer/r2dbc/mysql/codec/DefaultCodecs.java index c8049308a..9bdbe5787 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/codec/DefaultCodecs.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/codec/DefaultCodecs.java @@ -275,7 +275,7 @@ private static Class chooseClass(MySqlColumnMetadata metadata, Class type) return type.isAssignableFrom(javaType) ? javaType : type; } - private static Codec[] defaultCodecs(ByteBufAllocator allocator) { + private static Codec[] defaultCodecs() { return new Codec[] { ByteCodec.INSTANCE, ShortCodec.INSTANCE, @@ -318,23 +318,17 @@ private static Codec[] defaultCodecs(ByteBufAllocator allocator) { static final class Builder implements CodecsBuilder { - private final ByteBufAllocator allocator; - @GuardedBy("lock") private final ArrayList> codecs = new ArrayList<>(); private final ReentrantLock lock = new ReentrantLock(); - Builder(ByteBufAllocator allocator) { - this.allocator = allocator; - } - @Override public CodecsBuilder addFirst(Codec codec) { lock.lock(); try { if (codecs.isEmpty()) { - Codec[] defaultCodecs = defaultCodecs(allocator); + Codec[] defaultCodecs = defaultCodecs(); codecs.ensureCapacity(defaultCodecs.length + 1); // Add first. @@ -354,7 +348,7 @@ public CodecsBuilder addLast(Codec codec) { lock.lock(); try { if (codecs.isEmpty()) { - codecs.addAll(InternalArrays.asImmutableList(defaultCodecs(allocator))); + codecs.addAll(InternalArrays.asImmutableList(defaultCodecs())); } codecs.add(codec); } finally { @@ -369,7 +363,7 @@ public Codecs build() { try { try { if (codecs.isEmpty()) { - return new DefaultCodecs(defaultCodecs(allocator)); + return new DefaultCodecs(defaultCodecs()); } return new DefaultCodecs(codecs.toArray(new Codec[0])); } finally { diff --git a/src/main/java/io/asyncer/r2dbc/mysql/codec/ParametrizedCodec.java b/src/main/java/io/asyncer/r2dbc/mysql/codec/ParametrizedCodec.java index 966dfe189..9c43bedb4 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/codec/ParametrizedCodec.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/codec/ParametrizedCodec.java @@ -32,7 +32,7 @@ public interface ParametrizedCodec extends Codec { /** - * Decode a {@link ByteBuf} as specified {@link ParameterizedType}. + * Decodes a {@link ByteBuf} as specified {@link ParameterizedType}. * * @param value the {@link ByteBuf}. * @param metadata the metadata of the column. @@ -46,11 +46,11 @@ Object decode(ByteBuf value, MySqlColumnMetadata metadata, ParameterizedType tar CodecContext context); /** - * Check if can decode the field value as specified {@link ParameterizedType}. + * Checks if the field value can be decoded as specified {@link ParameterizedType}. * * @param metadata the metadata of the column. * @param target the specified {@link ParameterizedType}. - * @return if can decode. + * @return if it can decode. */ boolean canDecode(MySqlColumnMetadata metadata, ParameterizedType target); } diff --git a/src/main/java/io/asyncer/r2dbc/mysql/codec/PrimitiveCodec.java b/src/main/java/io/asyncer/r2dbc/mysql/codec/PrimitiveCodec.java index c5bfb2408..3e2c90691 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/codec/PrimitiveCodec.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/codec/PrimitiveCodec.java @@ -30,7 +30,7 @@ interface PrimitiveCodec extends Codec { /** - * Decode a {@link ByteBuf} as specified {@link Class}. + * Decodes a {@link ByteBuf} as specified {@link Class}. * * @param value the {@link ByteBuf}. * @param metadata the metadata of the column. @@ -44,15 +44,15 @@ T decode(ByteBuf value, MySqlColumnMetadata metadata, Class target, boolean b CodecContext context); /** - * Check if can decode the field value as a primitive data. + * Checks if the field value can be decoded as a primitive data. * * @param metadata the metadata of the column. - * @return if can decode. + * @return if it can decode. */ boolean canPrimitiveDecode(MySqlColumnMetadata metadata); /** - * Get the primitive {@link Class}, such as {@link Integer#TYPE}, etc. + * Gets the primitive {@link Class}, such as {@link Integer#TYPE}, etc. * * @return the primitive {@link Class}. */ diff --git a/src/main/java/io/asyncer/r2dbc/mysql/collation/CharsetTarget.java b/src/main/java/io/asyncer/r2dbc/mysql/collation/CharsetTarget.java index 8b78cb24b..2a17502a0 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/collation/CharsetTarget.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/collation/CharsetTarget.java @@ -20,7 +20,7 @@ import java.nio.charset.UnsupportedCharsetException; /** - * MySQL character collation target of {@link Charset}. + * A character collation {@link Charset} target of MySQL. */ interface CharsetTarget { diff --git a/src/main/java/io/asyncer/r2dbc/mysql/constant/ColumnDefinitions.java b/src/main/java/io/asyncer/r2dbc/mysql/constant/ColumnDefinitions.java deleted file mode 100644 index a5e98d257..000000000 --- a/src/main/java/io/asyncer/r2dbc/mysql/constant/ColumnDefinitions.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2023 asyncer.io projects - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.asyncer.r2dbc.mysql.constant; - -/** - * Column definition flags. - */ -public final class ColumnDefinitions { - - /** - * The data is not null. - */ - public static final int NOT_NULL = 1; - -// public static final int PRIMARY_PART = 1 << 1; // This field is a part of the primary key -// public static final int UNIQUE_PART = 1 << 2; // This field is a part of a unique key -// public static final int KEY_PART = 1 << 3; // This field is a part of a normal key -// public static final int BLOB = 1 << 4; - - /** - * The data is an unsigned number. Only applicable to numeric types, like BIGINT UNSIGNED, INT UNSIGNED, - * etc. - *

- * Note: IEEE-754 floating types (e.g. DOUBLE/FLOAT) do not supports it in MySQL 8.0+. When creating a - * column as an unsigned floating type, the server may report a warning. - */ - public static final int UNSIGNED = 1 << 5; - -// public static final int ZEROFILL = 1 << 6; -// public static final int BINARY = 1 << 7; - - /** - * The real type of this field is ENUMERABLE. - *

- * Note: in order to be compatible with older drivers, MySQL server will send type as VARCHAR for type - * ENUMERABLE. If this flag is enabled, change data type to ENUMERABLE. - */ - public static final int ENUMERABLE = 1 << 8; - -// public static final int AUTO_INCREMENT = 1 << 9; -// public static final int TIMESTAMP = 1 << 10; - - /** - * The real type of this field is SET. - *

- * Note: in order to be compatible with older drivers, MySQL server will send type as VARCHAR for type - * SET. If this flag is enabled, change data type to SET. - */ - public static final int SET = 1 << 11; // type is set - -// public static final int NO_DEFAULT = 1 << 12; // column has no default value -// public static final int ON_UPDATE_NOW = 1 << 13; // field will be set to NOW() in UPDATE statement - - private ColumnDefinitions() { } -} diff --git a/src/main/java/io/asyncer/r2dbc/mysql/constant/MySqlType.java b/src/main/java/io/asyncer/r2dbc/mysql/constant/MySqlType.java index 8628966db..196b70cf0 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/constant/MySqlType.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/constant/MySqlType.java @@ -146,7 +146,7 @@ public int getBinarySize() { }, /** - * A IEEE-754 single-precision floating point number type. It cannot be unsigned when the server version + * An IEEE-754 single-precision floating point number type. It cannot be unsigned when the server version * is 8.0 or higher. Otherwise, the server will report a warning when defining the column. */ FLOAT(MySqlType.ID_FLOAT, Float.class) { @@ -167,7 +167,7 @@ public int getBinarySize() { }, /** - * A IEEE-754 double-precision floating point number type. It cannot be unsigned when the server version + * An IEEE-754 double-precision floating point number type. It cannot be unsigned when the server version * is 8.0 or higher. Otherwise, the server will report a warning when defining the column. */ DOUBLE(MySqlType.ID_DOUBLE, Double.class) { @@ -332,7 +332,7 @@ public boolean isBinary() { }, /** - * A enumerable string type. It is a virtual type, server will enabled {@code ENUMERABLE} in column + * An enumerable string type. It is a virtual type, server will enabled {@code ENUMERABLE} in column * definitions and type is as {@link #VARCHAR}. */ ENUM(MySqlType.ID_ENUM, String.class) { @@ -661,7 +661,7 @@ public boolean isBinary() { } /** - * Get the fixed byte size of the data type in the binary protocol, otherwise {@literal 0} means that + * Gets the fixed byte size of the data type in the binary protocol, otherwise {@literal 0} means that * there is no fixed size. * * @return the fixed size in binary protocol. @@ -729,10 +729,9 @@ public static MySqlType of(int id, ColumnDefinition definition) { case ID_BLOB: return definition.isBinary() ? BLOB : TEXT; case ID_GEOMETRY: - // Most of Geometry libraries were using byte[] to encode/decode which based on WKT + // Most Geometry libraries were using byte[] to encode/decode which based on WKT // (includes Extended-WKT) or WKB // MySQL using WKB for encoding/decoding, so use byte[] instead of ByteBuffer by default type. - // It maybe change after R2DBC SPI specify default type for GEOMETRY. return GEOMETRY; default: return UNKNOWN; diff --git a/src/main/java/io/asyncer/r2dbc/mysql/internal/util/FluxEnvelope.java b/src/main/java/io/asyncer/r2dbc/mysql/internal/util/FluxEnvelope.java index 895b64f27..bfcb57a0b 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/internal/util/FluxEnvelope.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/internal/util/FluxEnvelope.java @@ -269,7 +269,7 @@ public void onComplete() { ByteBuf cumulated = this.cumulated; this.cumulated = null; - // The protocol need least one envelope, and the last must small than maximum size of envelopes. + // The protocol need least one envelope, and the last must smaller than maximum size of envelopes. // - If there has no previous envelope, then the cumulated is null, should produce an empty // envelope header. // - If previous envelope is a max-size envelope, then the cumulated is null, should produce an @@ -367,7 +367,7 @@ private static ByteBuf cumulate(ByteBufAllocator alloc, @Nullable ByteBuf cumula .setBytes(oldBytes, buf, buf.readerIndex(), bufBytes) .writerIndex(newBytes); buf.readerIndex(buf.writerIndex()); - // Release the old cumulated If write succeed (return will be succeed). + // Release the old cumulated If write succeed. releasing = cumulated; return result; diff --git a/src/main/java/io/asyncer/r2dbc/mysql/internal/util/VarIntUtils.java b/src/main/java/io/asyncer/r2dbc/mysql/internal/util/VarIntUtils.java index 76bcec9fb..ac6959c40 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/internal/util/VarIntUtils.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/internal/util/VarIntUtils.java @@ -178,7 +178,7 @@ public static int varIntBytes(int value) { * Reserve a seat of an unknown var integer in {@code buf} header. *

* Note: make sure the var integer will be set into the {@code buf} header, can not use it when you want - * write a var integer into a {@code buf} which has data before the var integer. i.e. the {@code buf} + * to write a var integer into a {@code buf} which has data before the var integer. i.e. the {@code buf} * should be a new {@link ByteBuf}. * * @param buf that want reserve to this {@link ByteBuf}. diff --git a/src/main/java/io/asyncer/r2dbc/mysql/message/FieldValue.java b/src/main/java/io/asyncer/r2dbc/mysql/message/FieldValue.java index 66b9b03d0..b98519375 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/message/FieldValue.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/message/FieldValue.java @@ -22,12 +22,12 @@ * A sealed interface for field, it has 3-implementations: {@link NullFieldValue}, {@link NormalFieldValue} * and {@link LargeFieldValue}. *

- * WARNING: it is sealed interface, should NEVER extends or implemented by another interface or class. + * WARNING: it is sealed interface, should NEVER extend or implemented by another interface or class. */ public interface FieldValue extends ReferenceCounted { /** - * Check if value is {@code null}. + * Checks if value is {@code null}. * * @return if value is {@code null}. */ @@ -36,7 +36,7 @@ default boolean isNull() { } /** - * Get an instance for {@code null} value. + * Gets an instance for {@code null} value. * * @return a field contains a {@code null} value. */ diff --git a/src/main/java/io/asyncer/r2dbc/mysql/message/LargeFieldValue.java b/src/main/java/io/asyncer/r2dbc/mysql/message/LargeFieldValue.java index f9d334f48..2459cf272 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/message/LargeFieldValue.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/message/LargeFieldValue.java @@ -28,7 +28,7 @@ /** * An implementation of {@link FieldValue} considers large field value which bytes width/size is greater than - * {@link Integer#MAX_VALUE}, it would be exists when MySQL server return LOB types (i.e. BLOB, CLOB), + * {@link Integer#MAX_VALUE}, it is used by the MySQL server returns LOB types (i.e. BLOB, CLOB), e.g. * LONGTEXT length can be unsigned int32. * * @see FieldValue diff --git a/src/main/java/io/asyncer/r2dbc/mysql/message/client/HandshakeResponse41.java b/src/main/java/io/asyncer/r2dbc/mysql/message/client/HandshakeResponse41.java index 810126bba..40bbd5ce0 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/message/client/HandshakeResponse41.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/message/client/HandshakeResponse41.java @@ -123,7 +123,7 @@ protected void writeTo(ByteBuf buf, ConnectionContext context) { } if (capability.isPluginAuthAllowed()) { - // This must be an UTF-8 string. + // This must be a UTF-8 string. HandshakeResponse.writeCString(buf, authType, StandardCharsets.UTF_8); } diff --git a/src/main/java/io/asyncer/r2dbc/mysql/message/client/ParamWriter.java b/src/main/java/io/asyncer/r2dbc/mysql/message/client/ParamWriter.java index 04a99754e..875e5e18d 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/message/client/ParamWriter.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/message/client/ParamWriter.java @@ -34,7 +34,7 @@ /** * A default implementation of {@link ParameterWriter}. *

- * WARNING: It is not safe for multithreaded access. + * WARNING: It is not thread safe */ final class ParamWriter extends ParameterWriter { @@ -324,7 +324,7 @@ private void escape(char c) { break; case '\'': // MySQL will auto-combine consecutive strings, like '1''2' -> '12'. - // Sure, there can use "\\'", but this will be better. (For some logging systems) + // Sure, there can use '1\'2', but this will be better. (For some logging systems) builder.append('\'').append('\''); break; // Maybe useful in the future, keep '"' here. diff --git a/src/main/java/io/asyncer/r2dbc/mysql/message/server/Eof320Message.java b/src/main/java/io/asyncer/r2dbc/mysql/message/server/Eof320Message.java index a06751fcd..83aa23306 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/message/server/Eof320Message.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/message/server/Eof320Message.java @@ -17,7 +17,7 @@ package io.asyncer.r2dbc.mysql.message.server; /** - * A EOF message for current context in protocol 3.20. + * An EOF message for current context in protocol 3.20. *

* Note: It is also Old Change Authentication Request. */ diff --git a/src/main/java/io/asyncer/r2dbc/mysql/message/server/Eof41Message.java b/src/main/java/io/asyncer/r2dbc/mysql/message/server/Eof41Message.java index c134f804b..489870fe8 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/message/server/Eof41Message.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/message/server/Eof41Message.java @@ -20,7 +20,7 @@ import io.netty.buffer.ByteBuf; /** - * A EOF message for current context in protocol 4.1. + * An EOF message for current context in protocol 4.1. */ final class Eof41Message implements EofMessage, WarningMessage, ServerStatusMessage { diff --git a/src/main/java/io/asyncer/r2dbc/mysql/message/server/HandshakeRequest.java b/src/main/java/io/asyncer/r2dbc/mysql/message/server/HandshakeRequest.java index eed96afca..c74c1a3ff 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/message/server/HandshakeRequest.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/message/server/HandshakeRequest.java @@ -26,35 +26,35 @@ public interface HandshakeRequest extends ServerMessage { /** - * Get the handshake request header. + * Gets the handshake request header. * * @return the header. */ HandshakeHeader getHeader(); /** - * Get the server-side capability. + * Gets the server-side capability. * * @return the server-side capability. */ Capability getServerCapability(); /** - * Get the authentication plugin type name. + * Gets the authentication plugin type name. * * @return the authentication plugin type. */ String getAuthType(); /** - * Get the challenge salt for authentication. + * Gets the challenge salt for authentication. * * @return the challenge salt. */ byte[] getSalt(); /** - * Decode a {@link HandshakeRequest} from a envelope {@link ByteBuf}. + * Decodes a {@link HandshakeRequest} from a payload {@link ByteBuf} of a normal packet. * * @param buf the {@link ByteBuf}. * @return decoded {@link HandshakeRequest}. diff --git a/src/main/java/io/asyncer/r2dbc/mysql/message/server/LargeFieldReader.java b/src/main/java/io/asyncer/r2dbc/mysql/message/server/LargeFieldReader.java index c649f99bd..d26975823 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/message/server/LargeFieldReader.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/message/server/LargeFieldReader.java @@ -36,7 +36,7 @@ /** * An implementation of {@link FieldReader} for large result which bytes more than {@link Integer#MAX_VALUE}, - * it would be exists when MySQL server return LOB types (i.e. BLOB, CLOB), LONGTEXT length can be unsigned + * it is used by the MySQL server returns LOB types (i.e. BLOB, CLOB), e.g. LONGTEXT length can be unsigned * int32. */ final class LargeFieldReader extends AbstractReferenceCounted implements FieldReader { diff --git a/src/main/java/io/asyncer/r2dbc/mysql/message/server/PrepareQueryDecodeContext.java b/src/main/java/io/asyncer/r2dbc/mysql/message/server/PrepareQueryDecodeContext.java index b5acdf728..cea0cf63c 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/message/server/PrepareQueryDecodeContext.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/message/server/PrepareQueryDecodeContext.java @@ -17,7 +17,7 @@ package io.asyncer.r2dbc.mysql.message.server; /** - * A implementation of {@link DecodeContext} for waiting {@code PreparedOkMessage}. + * An implementation of {@link DecodeContext} for waiting {@code PreparedOkMessage}. */ final class PrepareQueryDecodeContext implements DecodeContext { diff --git a/src/main/java/io/asyncer/r2dbc/mysql/message/server/ServerMessageDecoder.java b/src/main/java/io/asyncer/r2dbc/mysql/message/server/ServerMessageDecoder.java index 1c8577ab9..61876759b 100644 --- a/src/main/java/io/asyncer/r2dbc/mysql/message/server/ServerMessageDecoder.java +++ b/src/main/java/io/asyncer/r2dbc/mysql/message/server/ServerMessageDecoder.java @@ -172,7 +172,7 @@ private static ServerMessage decodeResult(List buffers, ConnectionConte } finally { combined.release(); } - // Should not has other messages when metadata reading. + // Should not have other messages when metadata reading. } return decodeRow(buffers, firstBuf, header, context, "result"); @@ -211,9 +211,9 @@ private static ServerMessage decodeCommandMessage(ByteBuf buf, ConnectionContext // Maybe OK, maybe column count (unsupported EOF on command phase) if (OkMessage.isValidSize(byteSize)) { - // MySQL has hard limit of 4096 columns per-table, - // so if readable bytes upper than 7, it means if it is column count, - // column count is already upper than (1 << 24) - 1 = 16777215, it is impossible. + // MySQL has hard limited of 4096 columns per-table, + // so if readable bytes is greater than 7, it means if it is column count, + // column count is already greater than (1 << 24) - 1 = 16777215, it is impossible. // So it must be OK message, not be column count. return OkMessage.decode(false, buf, context); } else if (EofMessage.isValidSize(byteSize)) { diff --git a/src/test/java/io/asyncer/r2dbc/mysql/PrepareParametrizedStatementTest.java b/src/test/java/io/asyncer/r2dbc/mysql/PrepareParametrizedStatementTest.java index 74bb3ee92..c44bc5b28 100644 --- a/src/test/java/io/asyncer/r2dbc/mysql/PrepareParametrizedStatementTest.java +++ b/src/test/java/io/asyncer/r2dbc/mysql/PrepareParametrizedStatementTest.java @@ -19,7 +19,6 @@ import io.asyncer.r2dbc.mysql.cache.Caches; import io.asyncer.r2dbc.mysql.client.Client; import io.asyncer.r2dbc.mysql.codec.Codecs; -import io.netty.buffer.UnpooledByteBufAllocator; import java.lang.reflect.Field; @@ -32,7 +31,7 @@ class PrepareParametrizedStatementTest implements StatementTestSupport