You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CommonUtil.getFileExtension includes parent-directory dots in the extension #21501
This concerns the public filename utility rather than a Check module, so the reproduction below calls the utility directly. I have not demonstrated a normal Checkstyle CLI failure.
Reproduction
Examined revision: 12c899d48d666c421989139de67c2e84cc6667ce (14.1.1-SNAPSHOT), macOS, Java 21. The same implementation is still present on current master.
Expected: an empty string in each case because the final filename has no extension. config.d/filename.properties should continue returning properties.
Cause and proposed change
getFileExtension searches the entire path for the final dot. Extracting the final filename before looking for a dot would make it consistent with the neighboring getFileNameWithoutExtension helper:
The current internal caller, TranslationCheck, already passes File.getName(), so its normal behavior is unaffected. Please confirm whether accepting paths in this public utility is intended; if the contract is deliberately restricted to bare filenames, documentation may be more appropriate.
Local validation of the proposed patch
Added two regression tests covering dotted parent directories and current/parent-relative paths, plus preservation of real extensions.
Before the production change: CommonUtilTest ran 50 tests with 2 failures, both new regression tests.
After: mvn test -Dtest=CommonUtilTest,TranslationCheckTest passed all 74 tests.
Java 21 mvn clean verify: BUILD SUCCESS; 6,789 unit/example tests (2 skipped) and 1,347 integration tests, no failures or errors.
I have a focused local patch ready and will wait for issue approval before opening a PR. Codex assisted with investigation, patch preparation, and local validation.
Thanks, @romani. Submitted the implementation in #21518 for review. It includes regression tests for dotted parent directories and relative paths. Java 21 mvn clean verify passed on the updated branch.
Activity
romani commentedon Sep 8, 2026
Please send PR, let me see more details at implementation place
ishu7w commentedon Sep 8, 2026
Thanks, @romani. Submitted the implementation in #21518 for review. It includes regression tests for dotted parent directories and relative paths. Java 21 mvn clean verify passed on the updated branch.
Issue #21501: Fix file extensions for paths with dotted directories
romani commentedon Sep 9, 2026
fix is merged