IpAddressMatcher Performance #14493
Labels
in: web
An issue in web modules (web, webmvc)
status: ideal-for-contribution
An issue that we actively are looking for someone to help us with
type: enhancement
A general enhancement
Uh oh!
There was an error while loading. Please reload this page.
Expected Behavior
Given that the following
String.format
inIpAddressMatcher
happens regardless of whether it's a valid ip address or not, there is a significant perfomance hit to doing the string formatting for even valid Ip Addresses.Assert.isTrue(this.requiredAddress.getAddress().length * 8 >= this.nMaskBits, String.format("IP address %s is too short for bitmask of length %d", ipAddress, this.nMaskBits));
Current Behavior
It does the
String.format
regardless given that it's usingAssert.isTrue
Context
Using an if statement or something equivalent like using the
Assert.isTrue
overloads withmessageSupplier
and only doing the format if needed for the exception should be sufficient but also doing the string formatter with something that doesn't use a pattern matcher should also be sufficient.The text was updated successfully, but these errors were encountered: