From b2edbaf5785725fe5d1ff537c6d895b4c23f8de0 Mon Sep 17 00:00:00 2001 From: Scott Leberknight <174812+sleberknight@users.noreply.github.com> Date: Sat, 10 Aug 2024 23:53:27 -0400 Subject: [PATCH] Clean up / fix grammatical errors in documentation and comments, part 6 --- .../config/SecureEndpointsConfiguration.java | 4 +-- .../java/org/kiwiproject/jdbc/SqlOrder.java | 6 ++-- .../java/org/kiwiproject/jsch/SftpConfig.java | 8 ++--- .../org/kiwiproject/jsch/SftpConnector.java | 2 +- .../org/kiwiproject/jsch/SftpTransfers.java | 2 +- .../json/RuntimeJsonException.java | 4 +-- .../kiwiproject/net/SimpleHostAndPort.java | 6 ++-- .../reflect/RuntimeReflectionException.java | 2 +- .../org/kiwiproject/retry/RetryResult.java | 10 +++---- .../kiwiproject/retry/RetryResultLogger.java | 14 ++++----- .../org/kiwiproject/retry/SimpleRetries.java | 30 +++++++++---------- .../org/kiwiproject/retry/SimpleRetryer.java | 20 ++++++------- .../retry/SimpleRetryerConfig.java | 2 +- .../java/org/kiwiproject/search/Sorted.java | 4 +-- .../security/SimpleSSLContextFactory.java | 8 ++--- .../spring/context/SpringContextBuilder.java | 4 +-- .../SecureEndpointsConfigurationTest.java | 2 +- 17 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/main/java/org/kiwiproject/config/SecureEndpointsConfiguration.java b/src/main/java/org/kiwiproject/config/SecureEndpointsConfiguration.java index 76537ffa..1de1fa95 100644 --- a/src/main/java/org/kiwiproject/config/SecureEndpointsConfiguration.java +++ b/src/main/java/org/kiwiproject/config/SecureEndpointsConfiguration.java @@ -15,7 +15,7 @@ /** * Configuration for secure REST endpoints, including the configuration from an {@link SSLContextConfiguration} * as well as adding a collection of {@link EndpointConfiguration} instances. Supports programmatic creation - * using a builder. Also supports construction from external configuration, e.g. from a YAML configuration file, using + * using a builder. Also supports construction from external configuration, e.g., from a YAML configuration file, using * the no-args constructor and setter methods. *
* As this is a configuration class that supports population from external configuration, it is mutable.
@@ -30,7 +30,7 @@ public class SecureEndpointsConfiguration extends SSLContextConfiguration {
private List
- * This is useful in building queries, for example when using JDBI and the SQL objects API you might
+ * This is useful in building queries, for example, when using JDBI and the SQL objects API you might
* need to add dynamic ordering based on user input but want to ensure no SQL injection attack is possible.
* So you would accept user input and then use {@link #from(String)} to get a {@link SqlOrder} instance.
* Then, you could use it in a JDBI {@code SqlQuery} annotation as one example.
@@ -23,7 +23,7 @@ public enum SqlOrder {
*
* @param value the value to convert from
* @return the SqlOrder enum corresponding to the given value
- * @throws IllegalArgumentException if an invalid value is provided that does not map to a SqlOrder enum constant
+ * @throws IllegalArgumentException if an invalid value is provided but does not map to a SqlOrder enum constant
*/
public static SqlOrder from(String value) {
var trimmedValue = Optional.ofNullable(value).map(String::trim).orElse("");
@@ -61,7 +61,7 @@ public
* The default is false. See the {@code ssh_info} man page for more details.
@@ -120,7 +120,7 @@ public class SftpConfig {
* @param host the remote host
* @param user the SFTP username
* @param password the SFTP password
- * @param privateKeyFilePath path to private key file
+ * @param privateKeyFilePath path to the private key file
* @param preferredAuthentications comma-separated list of authentications to attempt
* @param remoteBasePath root directory of the remote SFTP location
* @param errorPath local directory to write out any errors if SFTP fails
@@ -129,8 +129,8 @@ public class SftpConfig {
* @param timeout the SFTP connection timeout
* @implNote This is intentionally not using Lombok because using {@link lombok.AllArgsConstructor} together
* with @{@link lombok.Builder} results in an all-args constructor that does not respect {@link lombok.Builder.Default}.
- * As a result we need to handle the defaults ourselves. This is intended to be used during deserialization
- * from an external configuration file (e.g. a Dropwizard YAML configuration file, or from JSON). Prefer the
+ * As a result, we need to handle the defaults ourselves. This is intended to be used during deserialization
+ * from an external configuration file (e.g., a Dropwizard YAML configuration file, or from JSON). Prefer the
* builder when constructing programmatically.
*/
// Suppress Sonar's "Methods should not have too many parameters". We need this for the builder and for
diff --git a/src/main/java/org/kiwiproject/jsch/SftpConnector.java b/src/main/java/org/kiwiproject/jsch/SftpConnector.java
index e57ca61b..aeff6dc1 100644
--- a/src/main/java/org/kiwiproject/jsch/SftpConnector.java
+++ b/src/main/java/org/kiwiproject/jsch/SftpConnector.java
@@ -62,7 +62,7 @@ public SftpConnector(JSch jsch, SftpConfig config) {
*
* @param config The configuration used for setting up the connection
* @return The initialized and opened sftp connection
- * @apiNote This is a convenience method to not have to call connect after initialization.
+ * @apiNote This is a convenience method to not have to call {@code connect} after initialization.
*/
public static SftpConnector setupAndOpenConnection(SftpConfig config) {
return setupAndOpenConnection(new JSch(), config);
diff --git a/src/main/java/org/kiwiproject/jsch/SftpTransfers.java b/src/main/java/org/kiwiproject/jsch/SftpTransfers.java
index 3755bbe6..949464f5 100644
--- a/src/main/java/org/kiwiproject/jsch/SftpTransfers.java
+++ b/src/main/java/org/kiwiproject/jsch/SftpTransfers.java
@@ -191,7 +191,7 @@ public String getFileContent(Path remotePath, String remoteFilename) {
/**
* Gets a file off of a remote server with the given path and given filename and returns an {@link InputStream}. This
- * is useful if the remote file is binary and not a text based file.
+ * is useful if the remote file is binary and not a text-based file.
*
* Note: The caller of this method is responsible for closing the stream.
*
diff --git a/src/main/java/org/kiwiproject/json/RuntimeJsonException.java b/src/main/java/org/kiwiproject/json/RuntimeJsonException.java
index a9f2f4c1..508666ce 100644
--- a/src/main/java/org/kiwiproject/json/RuntimeJsonException.java
+++ b/src/main/java/org/kiwiproject/json/RuntimeJsonException.java
@@ -6,7 +6,7 @@
public class RuntimeJsonException extends RuntimeException {
/**
- * Create instance with given cause.
+ * Create an instance with the given cause.
*
* @param cause the cause
*/
@@ -15,7 +15,7 @@ public RuntimeJsonException(Throwable cause) {
}
/**
- * Create instance with given message and cause.
+ * Create an instance with the given message and cause.
*
* @param message the message
* @param cause the cause
diff --git a/src/main/java/org/kiwiproject/net/SimpleHostAndPort.java b/src/main/java/org/kiwiproject/net/SimpleHostAndPort.java
index 1c03872a..1628b217 100644
--- a/src/main/java/org/kiwiproject/net/SimpleHostAndPort.java
+++ b/src/main/java/org/kiwiproject/net/SimpleHostAndPort.java
@@ -14,7 +14,7 @@
* (Just go look at the code in {@link com.google.common.net.HostAndPort#fromString(String)} if you don't believe me.)
* Because it is much simpler, it also only handles a very specific host/port format, which is {@code host:port}.
*
- * It also does not attempt to validate anything about the host or port, e.g. it will happily accept a negative port
+ * It also does not attempt to validate anything about the host or port, e.g., it will happily accept a negative port
* value or a one-character long host name.
*/
@EqualsAndHashCode
@@ -33,7 +33,7 @@ public class SimpleHostAndPort {
*
* No validation is performed on the default values.
*
- * @param hostPortString a string containing host and port, e.g. acme.com:8001
+ * @param hostPortString a string containing host and port, e.g., acme.com:8001
* @param defaultHost a default host if the host/port string is blank
* @param defaultPort a default port if the host/port string is blank
* @return a new SimpleHostAndPort instance
@@ -49,7 +49,7 @@ public static SimpleHostAndPort from(String hostPortString, String defaultHost,
/**
* Parse {@code hostPortString} assuming format {@code host:port}
*
- * @param hostPortString a string containing host and port, e.g. foo.com:9000
+ * @param hostPortString a string containing host and port, e.g., foo.com:9000
* @return a new SimpleHostAndPort instance
* @throws IllegalStateException if not in the expected format
* @throws IllegalArgumentException if hostPortString is blank or port is not a valid number
diff --git a/src/main/java/org/kiwiproject/reflect/RuntimeReflectionException.java b/src/main/java/org/kiwiproject/reflect/RuntimeReflectionException.java
index 4a72e9b5..b19c5dd9 100644
--- a/src/main/java/org/kiwiproject/reflect/RuntimeReflectionException.java
+++ b/src/main/java/org/kiwiproject/reflect/RuntimeReflectionException.java
@@ -4,7 +4,7 @@
* A custom runtime exception for wrapping (checked or unchecked) exceptions related to reflection.
*
* There are no restrictions on the wrapped {@link Throwable}, but the intent is that they should be
- * some checked or unchecked exception that was thrown by a reflective operation, e.g. reflectively
+ * some checked or unchecked exception that was thrown by a reflective operation, e.g., reflectively
* finding or invoking a method, or accessing a field.
*/
@SuppressWarnings("unused")
diff --git a/src/main/java/org/kiwiproject/retry/RetryResult.java b/src/main/java/org/kiwiproject/retry/RetryResult.java
index b700c741..55210eb0 100644
--- a/src/main/java/org/kiwiproject/retry/RetryResult.java
+++ b/src/main/java/org/kiwiproject/retry/RetryResult.java
@@ -16,16 +16,16 @@
/**
* Defines a result of one or more attempts to get some type of object. The list of errors should reflect the order
- * in which errors occurred, e.g. the first error should be the error for the first attempt, second error should be
+ * in which errors occurred, e.g., the first error should be the error for the first attempt, the second error should be
* the error for the second attempt, etc.
*
- * A unique identifier is automatically assigned to new {@link RetryResult} instances for easy identification, e.g.
+ * A unique identifier is automatically assigned to new {@link RetryResult} instances for easy identification, e.g.,
* when logging retry exceptions.
*
- * Note that there is nothing precluding a {@link RetryResult} from representing a failure but not actually have any
+ * Note that there is nothing precluding a {@link RetryResult} from representing a failure but not have any
* errors. This could happen, for example, if retry code executes a {@link java.util.function.Supplier}
* and that supplier is implemented to catch all exceptions and return {@code null} to force a retry. We generally
- * recommend to implement Suppliers to throw exceptions when errors occur. They will need to be subclasses of
+ * recommend implementing Suppliers to throw exceptions when errors occur. They will need to be subclasses of
* {@link RuntimeException} since {@link java.util.function.Supplier} doesn't permit checked exceptions, plus we
* generally prefer unchecked exceptions.
*
@@ -143,7 +143,7 @@ public int getNumErrors() {
* Assumes there is at least one error, and returns the last one that was thrown regardless of the number
* of attempts.
*
- * You should check if there are any errors, e.g. using {@link #hasAnyErrors()}, before calling this method.
+ * You should check if there are any errors, e.g., using {@link #hasAnyErrors()}, before calling this method.
* Alternatively consider using {@link #getLastErrorIfPresent}.
*
* @return the most recent exception that occurred
diff --git a/src/main/java/org/kiwiproject/retry/RetryResultLogger.java b/src/main/java/org/kiwiproject/retry/RetryResultLogger.java
index b306aeae..271ccc28 100644
--- a/src/main/java/org/kiwiproject/retry/RetryResultLogger.java
+++ b/src/main/java/org/kiwiproject/retry/RetryResultLogger.java
@@ -25,8 +25,8 @@ public class RetryResultLogger {
*
* @param result the result
* @param logger the SLF4J logger to use
- * @param actionDescriptionSupplier a {@link Supplier} that provides a description of the action that was attempted
- * for example "Create new order #12345" or "Update order #456"
+ * @param actionDescriptionSupplier a {@link Supplier} that provides a description of the action that was attempted,
+ * for example, "Create new order #12345" or "Update order #456"
* @param
* The log levels are:
*
@@ -83,8 +83,8 @@ private static
diff --git a/src/main/java/org/kiwiproject/search/Sorted.java b/src/main/java/org/kiwiproject/search/Sorted.java
index 3a1a00c1..d6879e24 100644
--- a/src/main/java/org/kiwiproject/search/Sorted.java
+++ b/src/main/java/org/kiwiproject/search/Sorted.java
@@ -6,8 +6,8 @@
public interface Sorted {
/**
- * Defines a general sort direction, which will usually by something like "asc" or "desc" but can be customized
- * however an application likes.
+ * Defines a general sort direction, which will usually by something like "asc" or "desc" but it can be customized
+ * as an application likes.
*
* @return the sort direction
*/
diff --git a/src/main/java/org/kiwiproject/security/SimpleSSLContextFactory.java b/src/main/java/org/kiwiproject/security/SimpleSSLContextFactory.java
index 3906b9ef..0be31046 100644
--- a/src/main/java/org/kiwiproject/security/SimpleSSLContextFactory.java
+++ b/src/main/java/org/kiwiproject/security/SimpleSSLContextFactory.java
@@ -50,7 +50,7 @@ public class SimpleSSLContextFactory {
private SSLContext sslContext;
/**
- * This is not strictly needed when creating {@link SSLContext}s. It is here only in case this factory
+ * This is not strictly necessary when creating {@link SSLContext}s. It is here only in case this factory
* will be supplied to other code that makes HTTPS connections and needs to create {@link SSLContext}
* instances AND also needs to know whether it should perform hostname verification when making HTTPS
* requests.
@@ -59,7 +59,7 @@ public class SimpleSSLContextFactory {
private final boolean verifyHostname;
/**
- * This is not strictly needed when creating {@link SSLContext}s. It is here only in case this factory
+ * This is not strictly necessary when creating {@link SSLContext}s. It is here only in case this factory
* will be supplied to other code that makes HTTPS connections and needs to create {@link SSLContext}
* instances AND also needs to know whether it should perform SNI host checking.
*/
@@ -344,7 +344,7 @@ public static Builder builder() {
* Create/get a {@link SSLContext} instance for the key and trust store properties and protocol that this
* {@link SimpleSSLContextFactory} instance was built with.
*
- * @return a new {@link SSLContext} instance when first called; all subsequent calls return the same cached instance
+ * @return a new {@link SSLContext} instance when first called; all later calls return the same cached instance
* @implNote This is intended to be called infrequently, e.g., once when a service/app starts.
* It is internally synchronized to ensure thread-safety when creating the {@link SSLContext}.
*/
@@ -362,7 +362,7 @@ public SSLContext getSslContext() {
* Callers are responsible for securely handling the result, and not unnecessarily exposing it.
*
* @return a map containing the configuration of this factory
- * @apiNote This is publicly exposed, but should not generally be needed except in tests, and perhaps debugging.
+ * @apiNote This is publicly exposed but should not generally be necessary except in tests, and perhaps debugging.
* @implNote Uses {@link KiwiMaps#newHashMap(Object...)} because some values may be {@code null}, e.g., the key
* store path, and wraps that using {@link Collections#unmodifiableMap(Map)} to prevent modification of the
* returned map.
diff --git a/src/main/java/org/kiwiproject/spring/context/SpringContextBuilder.java b/src/main/java/org/kiwiproject/spring/context/SpringContextBuilder.java
index 0419e7e2..f35aa210 100644
--- a/src/main/java/org/kiwiproject/spring/context/SpringContextBuilder.java
+++ b/src/main/java/org/kiwiproject/spring/context/SpringContextBuilder.java
@@ -15,7 +15,7 @@
/**
* Builder class for easily constructing Spring ApplicationContext instances using either XML or annotation-based
* configuration. The generated ApplicationContext instance is built by creating a parent context, which contains
- * registered singleton beans, and then a child context. This allows specific singletons, e.g. a data source or a
+ * registered singleton beans, and then a child context. This allows specific singletons, e.g., a data source or a
* Dropwizard configuration object, to be accessible from the child context. The parent context beans can be referenced
* in either XML or annotation configurations.
*
@@ -79,7 +79,7 @@ private void checkConfigLocationsIsEmpty() {
}
/**
- * Add a single Spring XML configuration location.
+ * Add a Spring XML configuration location.
*
* @param location the XML config location, e.g. {@code applicationContext.xml}
* @return the builder instance
diff --git a/src/test/java/org/kiwiproject/config/SecureEndpointsConfigurationTest.java b/src/test/java/org/kiwiproject/config/SecureEndpointsConfigurationTest.java
index 9191ad0c..4ffb2055 100644
--- a/src/test/java/org/kiwiproject/config/SecureEndpointsConfigurationTest.java
+++ b/src/test/java/org/kiwiproject/config/SecureEndpointsConfigurationTest.java
@@ -68,7 +68,7 @@ private SecureEndpointsConfiguration loadFromYaml(String filename) {
}
}
- @SuppressWarnings("WeakerAccess") // must be public for Yaml to instantiate
+ @SuppressWarnings("WeakerAccess") // must be public for YAML to instantiate
@Getter
@Setter
public static class SampleAppConfig {
> ascSearch, Supplier
> des
/**
* Return a string that can be used directly in a SQL {@code ORDER BY} clause.
*
- * @return a string that can be used in a SQL query
+ * @return a string that can be used in an SQL query
*/
public String toSql() {
return name();
diff --git a/src/main/java/org/kiwiproject/jsch/SftpConfig.java b/src/main/java/org/kiwiproject/jsch/SftpConfig.java
index b10d2ac0..79fbb0a7 100644
--- a/src/main/java/org/kiwiproject/jsch/SftpConfig.java
+++ b/src/main/java/org/kiwiproject/jsch/SftpConfig.java
@@ -96,7 +96,7 @@ public class SftpConfig {
private String knownHostsFile;
/**
- * Provides option to disable strict host key checking, equivalent to the
+ * Provides an option to disable strict host key checking, equivalent to the
* {@code -o StrictHostKeyChecking=[yes|no]} option.
*