sahvx655-wq commented on PR #384: URL: https://github.com/apache/commons-validator/pull/384#issuecomment-4632700597
Yes, I think the infinity cases are worth closing. I traced the parse with a ParsePosition under Locale.US: the "Infinity"/"-Infinity" strings throw a ParseException so validate already returns null, but the locale infinity symbol (the U+221E glyph) parses with full consumption straight to POSITIVE_INFINITY, so the strict check passes and validate hands back an infinite Double. Same value, two spellings, opposite outcomes, which is the discrepancy you pointed at. So I've narrowed this PR to reject only infinite results in both processParsedValue methods and left NaN exactly as your edge-case tests pin it, since that one is symmetric and a legitimate value to validate. The risk if left is the same shape as the NaN one: an infinite value sails past isInRange/maxValue because the comparisons don't bound it, but here there's no matching "Infinity" string that validates, so nothing legitimate relies on the symbol getting through. Added a test in each class that derives the symbol from DecimalFormatSymbols so it follows the locale, and no JRE guard is needed because on Java 8 the symbol just fails to parse and still returns null. -- 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]
