Skip to content

Commit

Permalink
Avoid String allocations in MediaType.checkParameters
Browse files Browse the repository at this point in the history
Closes gh-29428
  • Loading branch information
dreis2211 authored and sbrannen committed Nov 4, 2022
1 parent a281d8c commit 2a853ae
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -531,10 +531,10 @@ public MediaType(MimeType mimeType) {
protected void checkParameters(String parameter, String value) {
super.checkParameters(parameter, value);
if (PARAM_QUALITY_FACTOR.equals(parameter)) {
value = unquote(value);
double d = Double.parseDouble(value);
String unquotedValue = unquote(value);
double d = Double.parseDouble(unquotedValue);
Assert.isTrue(d >= 0D && d <= 1D,
"Invalid quality value \"" + value + "\": should be between 0.0 and 1.0");
() -> "Invalid quality value \"" + value + "\": should be between 0.0 and 1.0");
}
}

Expand Down

0 comments on commit 2a853ae

Please sign in to comment.