Fix CodeQL note-severity alerts: confusable class and method names, and an unused verifier - #849
Merged
vharseko merged 1 commit intoAug 5, 2026
Conversation
…r, and drop a dead verifier CodeQL java/class-name-matches-super-class, java/confusing-method-name and java/unused-reference-type. The JDBC and Cassandra backends each named their storage implementation Storage, after the org.opends.server.backends.pluggable.spi.Storage they implement, so each had to spell the interface out in full in its own implements clause. They become JDBCStorage and CASStorage, matching JEStorage and PDBStorage. Both are constructed only by the configureStorage() of the Backend beside them, and the configuration definitions name that Backend rather than the storage class. SubentryManager.removeSubentry(Entry) called a helper named removeSubEntry(Map, Entry) twice, so the call sites read as if the method recursed. The helper becomes removeSubentryFrom(Map, Entry). BlindHostnameVerifier is package-private, referenced from nowhere, and accepts every hostname it is asked about. It is removed rather than left for someone to wire up. cassandra/Backend.java, which carried no license header, receives one.
maximthomas
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The last four note-severity alerts which are worth acting on: two classes named after their own supertype, two methods a capital letter apart, and a class nobody calls.
StorageimplementingStorage(2 ×java/class-name-matches-super-class)org.opends.server.backends.jdbc.Storageandorg.opends.server.backends.cassandra.Storageboth implementorg.opends.server.backends.pluggable.spi.Storage, which is why each of them has to spell the interface out in full in its ownimplementsclause. They are renamedJDBCStorageandCASStorage, after theJEStorageandPDBStorageof the other pluggable backends. Both are constructed in exactly one place —configureStorage()of theBackendnext to them — and referenced from their test cases; the configuration definitions name theBackendclass, not the storage, so nothing outside the code base refers to either name.While there,
cassandra/Backend.javareceived the license header it was missing.removeSubEntrynext toremoveSubentry(java/confusing-method-name)SubentryManagerhas a privateremoveSubentry(Entry)which drops a subentry from both of its maps by calling a privateremoveSubEntry(Map, Entry)twice — the two names differ only in the case of one letter, and the call sites read as if the method called itself:The helper becomes
removeSubentryFrom(Map, Entry), which says what it does and cannot be mistaken for its caller.A hostname verifier which verifies nothing (
java/unused-reference-type)BlindHostnameVerifieris package-private, is referenced from nowhere, and itsverify()returnstruefor every hostname. Dead code of that shape is worth removing rather than leaving around for someone to wire up: it is deleted.Testing
opendj-server-legacycompiles, main and test sources.SubentryManagerTestCaseandSubentryPasswordPolicyTestCasecover the renamed helper.Backend.configureStorage().