Avoid String allocations with Assert.isTrue()

This commit is contained in:
Sam Brannen
2022-11-05 14:51:36 +01:00
parent 82823517fa
commit ac5eb9bfd3
6 changed files with 9 additions and 10 deletions

View File

@@ -534,7 +534,7 @@ public final class ContentDisposition {
* @see <a href="https://tools.ietf.org/html/rfc2047">RFC 2047</a>
*/
private static String decodeQuotedPrintableFilename(String filename, Charset charset) {
Assert.notNull(filename, "'input' String` should not be null");
Assert.notNull(filename, "'input' String should not be null");
Assert.notNull(charset, "'charset' should not be null");
byte[] value = filename.getBytes(US_ASCII);

View File

@@ -186,7 +186,7 @@ public abstract class AbstractNamedValueArgumentResolver implements HttpServiceA
}
if (value == null) {
Assert.isTrue(!required, "Missing " + valueLabel + " value '" + name + "'");
Assert.isTrue(!required, () -> "Missing " + valueLabel + " value '" + name + "'");
return;
}