Fix grammatical errors in Exception messages.

Closes #2599.
This commit is contained in:
John Blum
2022-04-12 11:12:31 -07:00
parent 1792cd8f45
commit 656ef7e874
2 changed files with 9 additions and 11 deletions

View File

@@ -42,7 +42,7 @@ public abstract class Parameters<S extends Parameters<S, T>, T extends Parameter
public static final List<Class<?>> TYPES = Arrays.asList(Pageable.class, Sort.class);
private static final String PARAM_ON_SPECIAL = format("You must not user @%s on a parameter typed %s or %s",
private static final String PARAM_ON_SPECIAL = format("You must not use @%s on a parameter typed %s or %s",
Param.class.getSimpleName(), Pageable.class.getSimpleName(), Sort.class.getSimpleName());
private static final String ALL_OR_NOTHING = String.format(
"Either use @%s on all parameters except %s and %s typed once, or none at all!", Param.class.getSimpleName(),
@@ -301,8 +301,6 @@ public abstract class Parameters<S extends Parameters<S, T>, T extends Parameter
/**
* Asserts that either all of the non special parameters ({@link Pageable}, {@link Sort}) are annotated with
* {@link Param} or none of them is.
*
* @param method
*/
private void assertEitherAllParamAnnotatedOrNone() {

View File

@@ -69,12 +69,12 @@ public class QueryMethod {
Assert.notNull(metadata, "Repository metadata must not be null!");
Assert.notNull(factory, "ProjectionFactory must not be null!");
Parameters.TYPES.stream()//
.filter(type -> getNumberOfOccurences(method, type) > 1)//
Parameters.TYPES.stream()
.filter(type -> getNumberOfOccurences(method, type) > 1)
.findFirst().ifPresent(type -> {
throw new IllegalStateException(
String.format("Method must only one argument of type %s! Offending method: %s", type.getSimpleName(),
method.toString()));
String.format("Method must have only one argument of type %s! Offending method: %s",
type.getSimpleName(), method));
});
this.method = method;
@@ -89,8 +89,8 @@ public class QueryMethod {
}
if (hasParameterOfType(method, Sort.class)) {
throw new IllegalStateException(String.format("Method must not have Pageable *and* Sort parameter. "
+ "Use sorting capabilities on Pageable instead! Offending method: %s", method.toString()));
throw new IllegalStateException(String.format("Method must not have Pageable *and* Sort parameters. "
+ "Use sorting capabilities on Pageable instead! Offending method: %s", method));
}
}
@@ -99,7 +99,7 @@ public class QueryMethod {
if (isPageQuery()) {
Assert.isTrue(this.parameters.hasPageableParameter(),
String.format("Paging query needs to have a Pageable parameter! Offending method %s", method.toString()));
String.format("Paging query needs to have a Pageable parameter! Offending method: %s", method));
}
this.domainClass = Lazy.of(() -> {
@@ -311,6 +311,6 @@ public class QueryMethod {
}
}
throw new IllegalStateException("Method has to have one of the following return types! " + types.toString());
throw new IllegalStateException("Method has to have one of the following return types! " + types);
}
}