Description
The parsing of likes string does not handle edge cases properly. When Utils.removeNonDigitCharacters() returns null or an empty string, the code attempts to parse it with Integer.parseInt(), resulting in a NumberFormatException with a cryptic error message.
Expected Behavior
The parser should validate that the processed string contains digits before attempting to parse it. If no digits are found, it should throw a clear, descriptive ParsingException that explains what went wrong.
Actual Behavior
When a likes string contains no digits or when removeNonDigitCharacters() returns null, Integer.parseInt() throws a NumberFormatException with a generic error message that doesn't help users understand the actual problem.
Steps to Reproduce
- Process a likes string with no digits (e.g., "likes: N/A")
- Call the parsing method
- Result: NumberFormatException with unclear message
- Expected: ParsingException with message indicating no digits were found
Root Cause
The code lacks validation of the string returned by Utils.removeNonDigitCharacters() before passing it to Integer.parseInt().
Related
Resolved by PR #59
Description
The parsing of likes string does not handle edge cases properly. When
Utils.removeNonDigitCharacters()returns null or an empty string, the code attempts to parse it withInteger.parseInt(), resulting in a NumberFormatException with a cryptic error message.Expected Behavior
The parser should validate that the processed string contains digits before attempting to parse it. If no digits are found, it should throw a clear, descriptive ParsingException that explains what went wrong.
Actual Behavior
When a likes string contains no digits or when
removeNonDigitCharacters()returns null,Integer.parseInt()throws a NumberFormatException with a generic error message that doesn't help users understand the actual problem.Steps to Reproduce
Root Cause
The code lacks validation of the string returned by
Utils.removeNonDigitCharacters()before passing it toInteger.parseInt().Related
Resolved by PR #59