From 034a4d34a006b787d4ac2b4597d729acce1c2480 Mon Sep 17 00:00:00 2001 From: Scott Leberknight <174812+sleberknight@users.noreply.github.com> Date: Sat, 10 Aug 2024 16:37:10 -0400 Subject: [PATCH] Clean up / fix grammatical errors in documentation and comments (#1185) --- .github/workflows/build.yml | 2 +- .../java/org/kiwiproject/beans/BeanConverter.java | 6 +++--- .../java/org/kiwiproject/concurrent/Async.java | 6 +++--- .../org/kiwiproject/concurrent/AsyncException.java | 8 ++++---- .../kiwiproject/config/EndpointConfiguration.java | 14 +++++++------- .../kiwiproject/dropwizard/jdbi3/DatabaseType.java | 6 +++--- .../dropwizard/jdbi3/Jdbi3Builders.java | 2 +- .../ConstraintViolationExceptionMapper.java | 6 +++--- .../kiwiproject/jaxrs/exception/ErrorMessage.java | 2 +- .../jaxrs/exception/JaxrsBadRequestException.java | 6 +++--- .../jaxrs/exception/JaxrsConflictException.java | 10 +++++----- .../jaxrs/exception/JaxrsException.java | 12 ++++++------ .../jaxrs/exception/JaxrsForbiddenException.java | 6 +++--- .../JaxrsInternalServerErrorException.java | 8 ++++---- .../exception/JaxrsNotAuthorizedException.java | 10 +++++----- .../jaxrs/exception/JaxrsNotFoundException.java | 2 +- .../jaxrs/exception/JaxrsValidationException.java | 4 ++-- .../java/org/kiwiproject/jsch/JSchSlf4jLogger.java | 2 +- .../org/kiwiproject/json/FlexibleJsonModel.java | 6 +++--- src/main/java/org/kiwiproject/net/CidrRange.java | 6 +++--- .../org/kiwiproject/validation/DirectoryPath.java | 8 ++++---- .../org/kiwiproject/validation/FieldRange.java | 8 ++++---- .../java/org/kiwiproject/validation/FilePath.java | 4 ++-- .../java/org/kiwiproject/validation/InEnum.java | 10 +++++----- .../kiwiproject/validation/IntValueValidator.java | 2 +- .../validation/InternalKiwiValidators.java | 6 +++--- .../org/kiwiproject/validation/Ipv4AndPort.java | 6 +++--- .../exception/JaxrsValidationExceptionTest.java | 4 ++-- .../kiwiproject/junit/jupiter/ClearBoxTest.java | 2 +- .../util/BlankStringArgumentsProvider.java | 10 +++++----- 30 files changed, 92 insertions(+), 92 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ff8476ba..a2060685 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - # Setup the version of Java + # Set up the version of Java - name: Set up JDK ${{ matrix.java_version }} uses: actions/setup-java@v4 with: diff --git a/src/main/java/org/kiwiproject/beans/BeanConverter.java b/src/main/java/org/kiwiproject/beans/BeanConverter.java index 585bb179..1a84343f 100644 --- a/src/main/java/org/kiwiproject/beans/BeanConverter.java +++ b/src/main/java/org/kiwiproject/beans/BeanConverter.java @@ -65,7 +65,7 @@ public T convert(T input) { } /** - * This conversion method takes two parameters and copies properties from one object to another + * This conversion method takes two parameters, and it copies properties from one object to another * * @param input the object to copy the properties from * @param target the object to copy the properties too (destination) @@ -83,14 +83,14 @@ public R convert(T input, R target) { var propertyNames = getPropertySet(input, inputWrapper); - // This can not be a foreach because if failOnError is true, the exceptions need to bubble. + // This cannot be a foreach because if failOnError is true, the exceptions need to bubble. for (String propName : propertyNames) { if (hasPropertyMapper(propName)) { // custom mapper var func = getPropertyMapper(propName); func.apply(input); } else if (input != target) { - // only need to map simple properties if it's not the same object + // only need to map simple properties if it's a different object var inputValue = readBeanValue(input, inputWrapper, propName); writeBeanValue(target, targetWrapper, propName, inputValue); diff --git a/src/main/java/org/kiwiproject/concurrent/Async.java b/src/main/java/org/kiwiproject/concurrent/Async.java index 28af253c..33fd6b09 100644 --- a/src/main/java/org/kiwiproject/concurrent/Async.java +++ b/src/main/java/org/kiwiproject/concurrent/Async.java @@ -23,12 +23,12 @@ /** * Static utilities that work with {@link java.util.concurrent.CompletableFuture} and can make testing easier by - * permitting selective (e.g. in unit tests) forcing of synchronous behavior for things that would normally + * permitting selective (e.g., in unit tests) forcing of synchronous behavior for things that would normally * execute asynchronously. This applies only to some methods, so read the method's documentation before assuming. *

* Use the {@code xxxAsync} methods when you need to control concurrent behavior and make things deterministic - * during unit tests (e.g. blocking on futures). Note this does actually change the true behavior of the code under - * test, since methods will execute synchronously, so use with care, caution, and understanding. + * during unit tests (e.g., blocking on futures). Note this does actually change the true behavior of the code under + * test, since methods will execute synchronously, so use them with care, caution, and understanding. * * @implNote the "asyncMode" flag is a STATIC variable and should only ever be changed during testing using the * {@link #setUnitTestAsyncMode(Mode)} method. Generally, you should set this before tests and reset after diff --git a/src/main/java/org/kiwiproject/concurrent/AsyncException.java b/src/main/java/org/kiwiproject/concurrent/AsyncException.java index dd2acd96..27c19d01 100644 --- a/src/main/java/org/kiwiproject/concurrent/AsyncException.java +++ b/src/main/java/org/kiwiproject/concurrent/AsyncException.java @@ -23,7 +23,7 @@ public class AsyncException extends RuntimeException { private final transient CompletableFuture future; /** - * Construct instance with given message and future. + * Construct instance with the given message and future. * * @param message the exception message * @param future the {@link CompletableFuture} that caused the error, may be null @@ -34,7 +34,7 @@ public AsyncException(String message, @Nullable CompletableFuture future) { } /** - * Construct instance with given message, cause, and future. + * Construct instance with the given message, cause, and future. * * @param message the exception message * @param cause the original cause of the exception @@ -50,7 +50,7 @@ public AsyncException(String message, Throwable cause, @Nullable CompletableFutu * * @return true if this instance contains a CompletableFuture * @apiNote When a single asynchronous operation is performed and there is only one future, then callers can - * expect this to contain a CompletableFuture and return true. When multiple futures are acted upon (e.g. waiting + * expect this to contain a CompletableFuture and return true. When multiple futures are acted upon (e.g., waiting * for all to complete), callers should expect this instance not to contain a CompletableFuture and this method * to return false. */ @@ -59,7 +59,7 @@ public boolean hasFuture() { } /** - * The future which causes the exception. May be null. Use {@link #hasFuture()} to check if this instance + * The future which causes the exception; it may be null. Use {@link #hasFuture()} to check if this instance * contains a future. * * @param the generic type of the CompletableFuture diff --git a/src/main/java/org/kiwiproject/config/EndpointConfiguration.java b/src/main/java/org/kiwiproject/config/EndpointConfiguration.java index 0cb24bb3..5d425d35 100644 --- a/src/main/java/org/kiwiproject/config/EndpointConfiguration.java +++ b/src/main/java/org/kiwiproject/config/EndpointConfiguration.java @@ -30,7 +30,7 @@ public class EndpointConfiguration { /** * Use this to uniquely identify an endpoint within a {@link SecureEndpointsConfiguration}, or to provide - * a way to find an {@link EndpointConfiguration} in any collection of them, e.g. using a + * a way to find an {@link EndpointConfiguration} in any collection of them, e.g., using a * {@link java.util.stream.Stream#filter(Predicate)} on a stream of endpoint configurations. * * @see SecureEndpointsConfiguration#getEndpointByTag(String) @@ -39,7 +39,7 @@ public class EndpointConfiguration { private String tag; /** - * The connection scheme, e.g. https or https. + * The connection scheme, e.g., https or https. */ private String scheme; @@ -87,7 +87,7 @@ public class EndpointConfiguration { * instance that becomes the "parent" of this endpoint. * * @implNote This was implemented well before we started using Lombok, thus the manual builder code. Since there - * are some differences here, e.g. the constructor accepting the "parent" and the {@link #buildEndpoint()} method, + * are some differences here, e.g., the constructor accepting the "parent" and the {@link #buildEndpoint()} method, * not sure how feasible it is to refactor to use Lombok, or if it's worth bothering. In addition, we have left * the original setXxx() methods in here and added Lombok-style xxx() methods. While permissible, you * should be consistent in using all xxx() or all setXxx(). @@ -210,8 +210,8 @@ public boolean isSecure() { } /** - * Set the domain(s), which can be a single domain (e.g. example.org) or multiple domains separated by commas. If - * a comma-separated list of domains is specified, whitespace is allowed and trimmed. For example this is + * Set the domain(s), which can be a single domain (e.g., example.org) or multiple domains separated by commas. If + * a comma-separated list of domains is specified, whitespace is allowed and trimmed. For example, this is * valid: " domain-1.test , domain-2.test , domain-3.test " and results in the three domains "domain-1.test", * "domain-2.test", and "domain-3.test". * @@ -236,7 +236,7 @@ public List getDomains() { * round-robin among the domains returned by {@link #getDomains()}. * * @return the URI as a {@link String} - * @implNote This currently builds URIs using simple string substitution, any leading or trailing slashes + * @implNote This currently builds URIs using simple string substitution; any leading or trailing slashes * on the domain are stripped. */ public String getURI() { @@ -271,7 +271,7 @@ private String getUriWithNextHost(String thePath) { * ever a (good) reason to change this to use an internal lock or similar, it will be relatively easy since * this method is private, thus not a part of the public API. This change was made because of an error we * encountered wherein we saw some {@link ArrayIndexOutOfBoundsException} occurring on the - * {@code domainList.get(index)} call. This cause was due to multiple threads accessing concurrently. + * {@code domainList.get(index)} call. The cause was due to multiple threads accessing it concurrently. */ private synchronized String getNextDomain() { checkState(nonNull(domainList), "No domains have been set on this endpoint!"); diff --git a/src/main/java/org/kiwiproject/dropwizard/jdbi3/DatabaseType.java b/src/main/java/org/kiwiproject/dropwizard/jdbi3/DatabaseType.java index c06732b7..936375d4 100644 --- a/src/main/java/org/kiwiproject/dropwizard/jdbi3/DatabaseType.java +++ b/src/main/java/org/kiwiproject/dropwizard/jdbi3/DatabaseType.java @@ -9,7 +9,7 @@ /** * This enum allows you to instantiate a {@link JdbiPlugin} for certain databases based on the JDBC database URL. *

- * Currently, supports only Postgres and H2. + * Currently, this supports only Postgres and H2. */ enum DatabaseType { @@ -27,7 +27,7 @@ enum DatabaseType { /** * Given a JDBC database URL, attempt to find and instantiate a plugin. *

- * Currently, supports only H2 and Postgres. + * Currently, this supports only H2 and Postgres. * * @param databaseUrl the JDBC database URL * @return an Optional with a plugin instance or an empty Optional @@ -40,7 +40,7 @@ static Optional pluginFromDatabaseUrl(String databaseUrl) { /** * Determine the database type from the given JDBC database URL. *

- * Currently, supports only H2 and Postgres. + * Currently, this supports only H2 and Postgres. * * @param databaseUrl the JDBC database URL * @return an Optional containing the database type if found, otherwise an empty Optional diff --git a/src/main/java/org/kiwiproject/dropwizard/jdbi3/Jdbi3Builders.java b/src/main/java/org/kiwiproject/dropwizard/jdbi3/Jdbi3Builders.java index 3938f6f8..f03e6aa7 100644 --- a/src/main/java/org/kiwiproject/dropwizard/jdbi3/Jdbi3Builders.java +++ b/src/main/java/org/kiwiproject/dropwizard/jdbi3/Jdbi3Builders.java @@ -24,7 +24,7 @@ *

* The {@link SqlObjectPlugin} is always installed, and is assumed to be on the classpath. *

- * Note also that when installing plugins, JDBI ignores duplicates (e.g. if you attempt to install more than one + * Note also that when installing plugins, JDBI ignores duplicates (e.g., if you attempt to install more than one * {@link SqlObjectPlugin}) only when the plugin is designed as a "single-install" plugin. JDBI plugins * are "single-install" when they extend the package-private {@code JdbiPlugin.Singleton} class. */ diff --git a/src/main/java/org/kiwiproject/jaxrs/exception/ConstraintViolationExceptionMapper.java b/src/main/java/org/kiwiproject/jaxrs/exception/ConstraintViolationExceptionMapper.java index 504391ed..b94f14cb 100644 --- a/src/main/java/org/kiwiproject/jaxrs/exception/ConstraintViolationExceptionMapper.java +++ b/src/main/java/org/kiwiproject/jaxrs/exception/ConstraintViolationExceptionMapper.java @@ -16,15 +16,15 @@ * here. But in reality, many web frameworks use 422 to indicate an input validation failure, which is how we are * using it here. *

- * It is important to note that the {@link Response.Status} does not contain an enum constant for 422 status, + * It is important to note that the {@link Response.Status} does not contain an enum constant for status 422, * so that {@link Response.Status#fromStatusCode(int)} will return {@code null} when given 422. */ @Provider public class ConstraintViolationExceptionMapper implements ExceptionMapper { /** - * We have no way to obtain the item ID from a {@link ConstraintViolationException}. Instead, we will set - * it to null, which is not lovely but there's not much else we can do. + * We have no way to get the item ID from a {@link ConstraintViolationException}. Instead, we will set + * it to null, which is not lovely, but there's little else we can do. */ private static final String ITEM_ID = null; diff --git a/src/main/java/org/kiwiproject/jaxrs/exception/ErrorMessage.java b/src/main/java/org/kiwiproject/jaxrs/exception/ErrorMessage.java index a0ac324c..e6b0e513 100644 --- a/src/main/java/org/kiwiproject/jaxrs/exception/ErrorMessage.java +++ b/src/main/java/org/kiwiproject/jaxrs/exception/ErrorMessage.java @@ -18,7 +18,7 @@ * Dropwizard class of the same name. *

* Each instance contains the HTTP status (error) code; the error message; an optional identifier to identify the - * specific item causing the error (e.g. a primary key); and an optional field/property name for cases when a specific + * specific item causing the error (e.g., a primary key); and an optional field/property name for cases when a specific * field causes the error. */ @Getter diff --git a/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsBadRequestException.java b/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsBadRequestException.java index b290acef..ac2a7166 100644 --- a/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsBadRequestException.java +++ b/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsBadRequestException.java @@ -29,7 +29,7 @@ public JaxrsBadRequestException(String message) { } /** - * New instance with given message, cause, and 400 status code. + * New instance with given message, cause, and a 400 status code. * * @param message the message for this exception * @param cause the cause of this exception @@ -39,7 +39,7 @@ public JaxrsBadRequestException(String message, Throwable cause) { } /** - * New instance with the given message and field name, and 400 status code. + * New instance with the given message and field name, and a 400 status code. * * @param message the message for this exception * @param fieldName the field/property name that caused this error @@ -49,7 +49,7 @@ public JaxrsBadRequestException(String message, String fieldName) { } /** - * New instance with the given message, field name, item ID, and 400 status code. + * New instance with the given message, field name, item ID, and a 400 status code. * * @param message the message for this exception * @param fieldName the field/property name that caused this error diff --git a/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsConflictException.java b/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsConflictException.java index bbb35325..92037469 100644 --- a/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsConflictException.java +++ b/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsConflictException.java @@ -20,7 +20,7 @@ public JaxrsConflictException(Throwable cause) { } /** - * New instance with given message and 409 status code. + * New instance with given message and a 409 status code. * * @param message the message for this exception */ @@ -29,7 +29,7 @@ public JaxrsConflictException(String message) { } /** - * New instance with given message, cause, and 409 status code. + * New instance with given message, cause, and a 409 status code. * * @param message the message for this exception * @param cause the cause of this exception @@ -39,7 +39,7 @@ public JaxrsConflictException(String message, Throwable cause) { } /** - * New instance with the given message and field name, and 409 status code. + * New instance with the given message and field name, and a 409 status code. * * @param message the message for this exception * @param fieldName the field/property name that caused this error @@ -49,7 +49,7 @@ public JaxrsConflictException(String message, String fieldName) { } /** - * New instance with the given message, field name, item ID, and 409 status code. + * New instance with the given message, field name, item ID, and a 409 status code. * * @param message the message for this exception * @param fieldName the field/property name that caused this error @@ -60,7 +60,7 @@ public JaxrsConflictException(String message, String fieldName, String itemId) { } /** - * New instance with the given message, field name, item ID, cause, and 409 status code. + * New instance with the given message, field name, item ID, cause, and a 409 status code. * * @param message the message for this exception * @param fieldName the field/property name that caused this error diff --git a/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsException.java b/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsException.java index b3fd58dc..35519a24 100644 --- a/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsException.java +++ b/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsException.java @@ -80,7 +80,7 @@ public JaxrsException(String message, int statusCode) { } /** - * New instance with given message and cause. + * New instance with the given message and cause. * * @param message the message for this exception * @param cause the cause of this exception @@ -140,7 +140,7 @@ private static String nullSafeMessage(Throwable throwable) { } /** - * New "aggregate" instance with given list of ErrorMessage objects. The {@code statusCode} can be + * New "aggregate" instance with the given list of ErrorMessage objects. The {@code statusCode} can be * {@code null} if a "rolled up" overall status is desired, or an explicit code be given to represent * all the errors. The message of this exception is taken from the first ErrorMessage. * @@ -163,7 +163,7 @@ private static ErrorMessage firstErrorOrNull(List errors) { } /** - * New "aggregate" instance with given list of JaxrsException objects. + * New "aggregate" instance with the given list of JaxrsException objects. * * @param exceptions the JaxrsException objects that caused this exception */ @@ -231,17 +231,17 @@ public int getStatusCode() { * Calculates an overall status code as the "roll up" of the status codes in the ErrorMessage objects contained * in this exception. *

- * If there are no ErrorMessage objects a default status code is returned. If there is exactly one ErrorMessage, + * If there are no ErrorMessage objects, a default status code is returned. If there is exactly one ErrorMessage, * then its status code is returned. *

* If there are multiple ErrorMessage objects, and they all have the same status code, then the overall status * is just that status code. *

* Last, if there are multiple ErrorMessage objects, and some have different status codes, then the overall status - * is calculated to be the base status code (e.g. 400) of the highest error family (e.g. 4xx). For example, if + * is calculated to be the base status code (e.g., 400) of the highest error family (e.g., 4xx). For example, if * there are multiple 4xx errors then the overall status is considered as the base of the 4xx series, or 400. * Or if there are both 4xx and 5xx errors, the overall status is 500 (the base of the 5xx series). This is - * obviously a lossy "algorithm" and is meant as an overall indication of the error family. Inspection of all + * a lossy "algorithm" and is meant as an overall sign of the error family. Inspection of all * contained errors is required to fully determine the causes. * * @return the "rolled up" status code diff --git a/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsForbiddenException.java b/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsForbiddenException.java index 81aeab01..86c7d665 100644 --- a/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsForbiddenException.java +++ b/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsForbiddenException.java @@ -29,7 +29,7 @@ public JaxrsForbiddenException(String message) { } /** - * New instance with given message, cause, and 403 status code. + * New instance with the given message, cause, and 403 status code. * * @param message the message for this exception * @param cause the cause of this exception @@ -39,7 +39,7 @@ public JaxrsForbiddenException(String message, Throwable cause) { } /** - * New instance with the given message and field name, and 403 status code. + * New instance with the given message and field name, and a 403 status code. * * @param message the message for this exception * @param fieldName the field/property name that caused this error @@ -49,7 +49,7 @@ public JaxrsForbiddenException(String message, String fieldName) { } /** - * New instance with the given message, field name, item ID, and 403 status code. + * New instance with the given message, field name, item ID, and a 403 status code. * * @param message the message for this exception * @param fieldName the field/property name that caused this error diff --git a/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsInternalServerErrorException.java b/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsInternalServerErrorException.java index 0dc6f873..cc21d7c0 100644 --- a/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsInternalServerErrorException.java +++ b/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsInternalServerErrorException.java @@ -30,7 +30,7 @@ public JaxrsInternalServerErrorException(String message) { } /** - * New instance with given message, cause, and 500 status code. + * New instance with given message, cause, and a 500 status code. * * @param message the message for this exception * @param cause the cause of this exception @@ -40,7 +40,7 @@ public JaxrsInternalServerErrorException(String message, Throwable cause) { } /** - * New instance with the given message and field name, and 500 status code. + * New instance with the given message and field name, and a 500 status code. * * @param message the message for this exception * @param fieldName the field/property name that caused this error @@ -50,7 +50,7 @@ public JaxrsInternalServerErrorException(String message, String fieldName) { } /** - * New instance with the given message, field name, item ID, and 500 status code. + * New instance with the given message, field name, item ID, and a 500 status code. * * @param message the message for this exception * @param fieldName the field/property name that caused this error @@ -61,7 +61,7 @@ public JaxrsInternalServerErrorException(String message, String fieldName, Strin } /** - * New instance with the given message, field name, item ID, cause, and 500 status code. + * New instance with the given message, field name, item ID, cause, and a 500 status code. * * @param message the message for this exception * @param fieldName the field/property name that caused this error diff --git a/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsNotAuthorizedException.java b/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsNotAuthorizedException.java index d5760a96..04f5d53a 100644 --- a/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsNotAuthorizedException.java +++ b/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsNotAuthorizedException.java @@ -20,7 +20,7 @@ public JaxrsNotAuthorizedException(Throwable cause) { } /** - * New instance with given message and 401 status code. + * New instance with given message and a 401 status code. * * @param message the message for this exception */ @@ -29,7 +29,7 @@ public JaxrsNotAuthorizedException(String message) { } /** - * New instance with given message, cause, and 401 status code. + * New instance with given message, cause, and a 401 status code. * * @param message the message for this exception * @param cause the cause of this exception @@ -39,7 +39,7 @@ public JaxrsNotAuthorizedException(String message, Throwable cause) { } /** - * New instance with the given message and field name, and 401 status code. + * New instance with the given message and field name, and a 401 status code. * * @param message the message for this exception * @param fieldName the field/property name that caused this error @@ -49,7 +49,7 @@ public JaxrsNotAuthorizedException(String message, String fieldName) { } /** - * New instance with the given message, field name, item ID, and 401 status code. + * New instance with the given message, field name, item ID, and a 401 status code. * * @param message the message for this exception * @param fieldName the field/property name that caused this error @@ -60,7 +60,7 @@ public JaxrsNotAuthorizedException(String message, String fieldName, String item } /** - * New instance with the given message, field name, item ID, cause, and 401 status code. + * New instance with the given message, field name, item ID, cause, and a 401 status code. * * @param message the message for this exception * @param fieldName the field/property name that caused this error diff --git a/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsNotFoundException.java b/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsNotFoundException.java index 5bb3e90d..bc083ff5 100644 --- a/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsNotFoundException.java +++ b/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsNotFoundException.java @@ -29,7 +29,7 @@ public JaxrsNotFoundException(String message) { } /** - * New instance with given message, cause, and 404 status code. + * New instance with the given message, cause, and 404 status code. * * @param message the message for this exception * @param cause the cause of this exception diff --git a/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsValidationException.java b/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsValidationException.java index d1e76cbd..8c6f74b0 100644 --- a/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsValidationException.java +++ b/src/main/java/org/kiwiproject/jaxrs/exception/JaxrsValidationException.java @@ -29,7 +29,7 @@ public class JaxrsValidationException extends JaxrsException { * Each map contained in {@code errorMessageMaps} must have entries with at least two keys: * {@link ErrorMessage#KEY_FIELD_NAME} and {@link ErrorMessage#KEY_MESSAGE}. In other words, the * maps should contain an entry whose key is {@link ErrorMessage#KEY_FIELD_NAME} and another entry - * whose key is {@link ErrorMessage#KEY_MESSAGE}. Any other entries are ignored. The value of these + * whose key is {@link ErrorMessage#KEY_MESSAGE}. Any other entries are ignored. The values of these * two entries become the field name and message in the resulting {@link ErrorMessage} objects. * * @param itemId the unique ID of the item that caused this error @@ -75,7 +75,7 @@ public JaxrsValidationException(String itemId, Set * Usually you should use {@link #JSchSlf4jLogger(Logger)} in order to specify the SLF4J {@link Logger} explicitly * to control the logging level and logger name. diff --git a/src/main/java/org/kiwiproject/json/FlexibleJsonModel.java b/src/main/java/org/kiwiproject/json/FlexibleJsonModel.java index e50e06d6..8f046aa5 100644 --- a/src/main/java/org/kiwiproject/json/FlexibleJsonModel.java +++ b/src/main/java/org/kiwiproject/json/FlexibleJsonModel.java @@ -9,7 +9,7 @@ /** * This class can be used as a base class for situations where there may be additional/unknown properties in - * a JSON string that don't have a corresponding property in the class being de-serialized into. It uses Jackson's + * a JSON string that don't have a corresponding property in the class being deserialized into. It uses Jackson's * {@link JsonAnyGetter} and {@link JsonAnySetter} feature to get and set these "extra fields" in a property * named {@code extraFields}. *

@@ -30,7 +30,7 @@ public abstract class FlexibleJsonModel { protected final Map extraFields = new HashMap<>(); /** - * Returns the "extra" fields that were not explicitly defined as properties when this object was de-serialized + * Returns the "extra" fields that were not explicitly defined as properties when this object was deserialized * from JSON. * * @return the extra fields @@ -41,7 +41,7 @@ public Map getExtraFields() { } /** - * Add an "extra" field when de-serializing from JSON. + * Add an "extra" field when deserializing from JSON. * * @param key the extra field name * @param value the value of the extra field diff --git a/src/main/java/org/kiwiproject/net/CidrRange.java b/src/main/java/org/kiwiproject/net/CidrRange.java index f0798eaa..968230f1 100644 --- a/src/main/java/org/kiwiproject/net/CidrRange.java +++ b/src/main/java/org/kiwiproject/net/CidrRange.java @@ -11,7 +11,7 @@ *

* This utility was copied and enhanced from * https://github.com/edazdarevic/CIDRUtils which has not been - * updated since 2019 and seems to be unmaintained. + * updated since 2019 and seems unmaintained. */ public class CidrRange { @@ -78,7 +78,7 @@ private void calculate() { } /** - * Returns the network address for the CIDR. For example: 192.168.100.15/24 will return 192.168.100.0. + * Returns the network address for the CIDR. For example, 192.168.100.15/24 will return 192.168.100.0. * * @return The network address for the CIDR */ @@ -87,7 +87,7 @@ public String getNetworkAddress() { } /** - * Returns the broadcast address for the CIDR. For example: 192.168.100.15/24 will return 192.168.100.255. + * Returns the broadcast address for the CIDR. For example, 192.168.100.15/24 will return 192.168.100.255. * * @return The broadcast address for the CIDR */ diff --git a/src/main/java/org/kiwiproject/validation/DirectoryPath.java b/src/main/java/org/kiwiproject/validation/DirectoryPath.java index 53f4a700..09e495c7 100644 --- a/src/main/java/org/kiwiproject/validation/DirectoryPath.java +++ b/src/main/java/org/kiwiproject/validation/DirectoryPath.java @@ -20,7 +20,7 @@ * intended usage of this annotation with respect to the potential for * Path Traversal attacks. *

- * By default, does not permit null values. If the element being validated allows {@code null} values, you can + * By default, this does not permit null values. If the element being validated allows {@code null} values, you can * set {@link #allowNull()} to {@code true}. *

* You can also use {@link #ensureReadable()} and {@link #ensureWritable()} to verify that the directory is readable @@ -45,7 +45,7 @@ * * @implNote This annotation is not intended to validate user input from client-side applications, because of the * possibility of Path Traversal attacks. Instead, - * the intended usage is to validate application configuration parameters, e.g. an application reads a local + * the intended usage is to validate application configuration parameters, e.g., an application reads a local * configuration file at startup. Even this is not 100% safe, since the configuration could come from a remote * location such as a configuration service, so users should understand the usage risks and mitigate when possible. */ @@ -69,7 +69,7 @@ boolean allowNull() default false; /** - * Whether to verify that the specified directory can be read by the current process. + * Whether to verify that the current process can read the specified directory. * The default is false (no verification is performed). * * @return true to validate the directory is readable; if false does not verify @@ -77,7 +77,7 @@ boolean ensureReadable() default false; /** - * Whether to verify that the specified directory can be read by the current process. + * Whether to verify that the current process can read the specified directory. * The default is false (no verification is performed). * * @return true to validate the directory is writable; if false does not verify diff --git a/src/main/java/org/kiwiproject/validation/FieldRange.java b/src/main/java/org/kiwiproject/validation/FieldRange.java index 66688a99..b34c6527 100644 --- a/src/main/java/org/kiwiproject/validation/FieldRange.java +++ b/src/main/java/org/kiwiproject/validation/FieldRange.java @@ -12,16 +12,16 @@ import java.lang.annotation.Target; /** - * The annotated type must have two fields that define a valid range, i.e. in the simplest configuration + * The annotated type must have two fields that define a valid range, i.e., in the simplest configuration * {@link #startField()} must come before {@link #endField()}. You can have multiple {@link FieldRange} annotations * on a type, either as standalone annotations or inside a {@link FieldRanges} annotation. *

* The main restriction imposed by this annotation is that {@link #startField()} and {@link #endField()} must be - * {@link Comparable}. It is also assumed that they are defined to both have the same type, e.g. both are Integer + * {@link Comparable}. It is also assumed that they are defined to both have the same type, e.g., both are Integer * or {@link java.time.Instant}. No guarantees are made if they are different types, and most likely unpredictable * results and/or exceptions will occur. *

- * Note also that direct field access using reflection is used to obtain the start and end values as + * Note also that direct field access using reflection is used to get the start and end values as * currently implemented. *

* By default, null values are not allowed, and the range check is exclusive, meaning start cannot equal end. You can @@ -44,7 +44,7 @@ * Finally, assuming there are no minimum or maximum values specified and that the type being validated contains * only a time component, e.g. {@link java.time.LocalTime LocalTime}, then there is an edge case between * 12:00 AM (00:00) and 1:00 AM (01:00) that may result in unexpected validation failures. For example, if the first - * time in the range is 11:56 PM (23:56) and the second is 12:15 AM (00:15), then without a date to indicate whether + * time in the range is 11:56 PM (23:56), and the second is 12:15 AM (00:15), then without a date to indicate whether * the times cross a midnight boundary, this range will be considered as invalid. The reason is simply that within a * single day (again because there is no date component to indicate otherwise), 12:15 AM always comes before 23:56 PM. */ diff --git a/src/main/java/org/kiwiproject/validation/FilePath.java b/src/main/java/org/kiwiproject/validation/FilePath.java index e7289c00..24c7c2be 100644 --- a/src/main/java/org/kiwiproject/validation/FilePath.java +++ b/src/main/java/org/kiwiproject/validation/FilePath.java @@ -20,7 +20,7 @@ * intended usage of this annotation with respect to the potential for * Path Traversal attacks. *

- * By default, does not permit null values. If the element being validated allows {@code null} values, you can + * By default, this does not permit null values. If the element being validated allows {@code null} values, you can * set {@link #allowNull()} to {@code true}. *

* Examples: @@ -35,7 +35,7 @@ * * @implNote This annotation is not intended to validate user input from client-side applications, because of the * possibility of Path Traversal attacks. Instead, - * the intended usage is to validate application configuration parameters, e.g. an application reads a local + * the intended usage is to validate application configuration parameters, e.g., an application reads a local * configuration file at startup. Even this is not 100% safe, since the configuration could come from a remote * location such as a configuration service, so users should understand the usage risks and mitigate when possible. */ diff --git a/src/main/java/org/kiwiproject/validation/InEnum.java b/src/main/java/org/kiwiproject/validation/InEnum.java index 849dc0ef..b90f448f 100644 --- a/src/main/java/org/kiwiproject/validation/InEnum.java +++ b/src/main/java/org/kiwiproject/validation/InEnum.java @@ -19,9 +19,9 @@ * The annotated element must have a value in the specified enum class. *

* For example, if you have a String property that you want to constrain to one of the values in an enum, you can - * apply this annotation, and specify the enum class to validate against. + * apply this annotation and specify the enum class to validate against. *

- * By default, does not permit null values. If the element being validated permits nulls, you can set + * By default, this does not permit null values. If the element being validated permits nulls, you can set * {@link #allowNull()} to {@code true}. *

* You can optionally perform case-insensitive validation using {@link #ignoreCase()} or specify a custom method @@ -66,15 +66,15 @@ boolean allowNull() default false; /** - * Whether to ignore case. By default, match is case-sensitive. + * Whether to ignore the case. By default, match is case-sensitive. * - * @return true to ignore case, false to perform a case-sensitive match. + * @return true to ignore the case, false to perform a case-sensitive match. */ boolean ignoreCase() default false; /** * By default, {@link InEnum} uses the enum constants as the values to validate against. If there is a specific - * method in the enum which provides a String value that should be used for validation instead of the enum + * method in the enum that provides a String value to use for validation instead of the enum * constants, specify it here. *

* For example, if you have a {@code Season} enum with values like {@code FALL} and {@code SPRING}, but the diff --git a/src/main/java/org/kiwiproject/validation/IntValueValidator.java b/src/main/java/org/kiwiproject/validation/IntValueValidator.java index fd49ad8b..f5ad53bb 100644 --- a/src/main/java/org/kiwiproject/validation/IntValueValidator.java +++ b/src/main/java/org/kiwiproject/validation/IntValueValidator.java @@ -6,7 +6,7 @@ import jakarta.validation.ConstraintValidatorContext; /** - * Validates that a string value is an integer value, i.e. that it can be converted to an int or {@link Integer}. + * Validates that a string value is an integer value, i.e., that it can be converted to an int or {@link Integer}. */ public class IntValueValidator implements ConstraintValidator { diff --git a/src/main/java/org/kiwiproject/validation/InternalKiwiValidators.java b/src/main/java/org/kiwiproject/validation/InternalKiwiValidators.java index db8f48ea..23f10d9f 100644 --- a/src/main/java/org/kiwiproject/validation/InternalKiwiValidators.java +++ b/src/main/java/org/kiwiproject/validation/InternalKiwiValidators.java @@ -22,7 +22,7 @@ class InternalKiwiValidators { static final String TEMPLATE_REQUIRED = "{org.kiwiproject.validation.Required.message}"; /** - * Convert a string representation of a "compare value" (for example a string representing a minimum or maximum) + * Convert a string representation of a "compare value" (for example, a string representing a minimum or maximum) * into an object of the same type as {@code value}. *

* If the "compare value" is blank (null, empty, or only whitespace) or {@code value} is {@code null}, then @@ -31,7 +31,7 @@ class InternalKiwiValidators { * As a concrete example, the {@code compareValue} might be the String from a min() or max() in a validation * annotation such as {@link Range}. In order to compare with {@code value}, we need to convert that String to the * same type as {@code value}. Suppose we are given a compare value of "10" and {@code value} is a {@link Long}. - * In this case, "10" must is converted into a {@link Long}. + * In this case, "10" is converted into a {@link Long}. *

* The supported types are: *