bkkothari2255 commented on code in PR #72:
URL:
https://github.com/apache/sling-org-apache-sling-xss/pull/72#discussion_r4764757130
##########
src/main/java/org/apache/sling/xss/impl/XSSAPIImpl.java:
##########
@@ -150,7 +149,10 @@ public Long getValidLong(String source, long defaultValue)
{
public Double getValidDouble(String source, double defaultValue) {
if (source != null && source.length() > 0) {
try {
- return validator.getValidDouble("XSS", source, 0d,
Double.MAX_VALUE, false);
+ double d = Double.parseDouble(source.trim());
+ if (d >= 0d && d <= Double.MAX_VALUE && !Double.isNaN(d) &&
!Double.isInfinite(d)) {
+ return d;
+ }
} catch (Exception e) {
LOGGER.warn("Unable to get a valid double from the input.", e);
Review Comment:
Fixed in
[9811aad](https://github.com/apache/sling-org-apache-sling-xss/pull/72/commits/9811aada08c933477a9cbfaa8aca0ffa77f7af27)
moved the `NumberFormatException` details to DEBUG so rejected input values
aren't logged at WARN
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]