Auxilus08 opened a new pull request, #8130: URL: https://github.com/apache/gravitino/pull/8130
fix: trim trailing spaces in removeIdFromComment method ### What changes were proposed in this pull request? - Modified removeIdFromComment method to call trim() on the result - Added test case testRemoveIdFromCommentTrimsTrailingSpaces to verify the fix - Ensures that comments with trailing spaces are properly trimmed when removing identifier This PR fixes the `removeIdFromComment` method in `StringIdentifier.java` to properly trim trailing whitespace when removing identifiers from comments. The method now calls `.trim()` on the result before returning it. ### Why are the changes needed? The `removeIdFromComment` method was not handling trailing spaces correctly. When a comment had trailing whitespace (e.g., "This is a comment "), the method would return the comment with those trailing spaces intact instead of a clean, trimmed result. This inconsistency could lead to unexpected behavior when processing comments. The fix ensures that the method returns consistent, clean results by trimming any leading or trailing whitespace from the comment after the identifier is removed. ### Does this PR introduce _any_ user-facing change? No user-facing API changes are introduced. This is a behavioral fix that ensures more consistent output from the `removeIdFromComment` method. Users will now receive trimmed comments instead of comments with trailing spaces, which is the expected behavior. ### How was this patch tested? 1. Added a new test case `testRemoveIdFromCommentTrimsTrailingSpaces` that specifically tests the scenario where a comment has trailing spaces 2. The test verifies that when an identifier is removed from a comment with trailing spaces, the result is properly trimmed 3. Existing tests continue to pass, ensuring backward compatibility 4. All changes were committed and pushed with exit code 0, indicating successful completion -- 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]
