Fix CodeQL note-severity alerts: the leftovers of the already-fixed rules - #850
Merged
Merged
Conversation
Sites skipped as marginal when the main batch of each rule was fixed. ProductInformation read its four numeric properties through Integer.valueOf(properties.getProperty(...)), so a bundle missing one failed with NumberFormatException: null. They go through an intProperty() which names the key and the value in the MissingResourceException the class already throws when its bundle cannot be used. Five comparisons against the empty string become isEmpty(), a stale @param tag is dropped, and five locals which were never read are gone: TempLogFile assigned the publisher addPublisherIfRequired() had already registered, RemoteReplicationPortsPanel read a map key its loop ignores, and the decoder of EndTransactionExtendedRequest bound names to a message ID and controls it then dropped. That decoder still reads those values, because it has to consume them, and now says why it can do no better: getValue() writes each control as its value alone, without OID or criticality, so a Control cannot be rebuilt until both sides are fixed together. BufferPool fills an ArrayBlockingQueue sized for exactly the buffers it allocates, and ignored what offer() returned; add() throws if that invariant ever breaks. Nineteen alerts of these rules stay open. Five are wrong: the rotation times are constrained to four digits by the configuration definition, the CTS token parse runs inside a promise chain which converts any runtime exception into an AccessTokenException, and two ignored offer() calls are on unbounded ConcurrentLinkedQueues. The other fourteen are calls into deprecated configuration APIs whose replacement needs a ServerContext threaded through the legacy layer, plus Subject.getSubject(), whose replacement requires Java 18.
maximthomas
approved these changes
Aug 5, 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 leftovers of the note-severity rules whose main batches are already merged: the sites which were skipped as marginal at the time, gathered here so those rules reach zero except where the alert is provably wrong or the fix is a refactoring of its own.
Sixteen alerts closed
java/inefficient-empty-string-test(5) —"".equals(x)becomesx.isEmpty()inInstallDS,Installer,NewSchemaElementsTask,LDIFChangeRecordReaderandConsoleApplication. Each was already guarded against null on the line above or by the surrounding call.java/uncaught-number-format-exception(4) —ProductInformationreadversion.build,version.major,version.minorandversion.pointthroughInteger.valueOf(properties.getProperty(...)), so a bundle without them failed withNumberFormatException: nulland no hint at what was wrong. They go through oneintProperty()which reports the offending key and value as theMissingResourceExceptionthe rest of the class already throws when its bundle is unusable.java/local-variable-is-never-read(5) —TempLogFileassigned the publisheraddPublisherIfRequired()had already registered,RemoteReplicationPortsPanelread a map key its loop does not use, andEndTransactionExtendedRequestdecoded a message ID, a control list and each encoded control only to drop them. That decoder cannot do better today, and the comment now says why:getValue()writes each control as its value alone, without OID or criticality, so aControlcannot be rebuilt from the wire until both sides are completed together. The values are still read, because the reader has to consume them; they are simply no longer bound to names that suggest otherwise.java/ignored-error-status-of-call(1) —OnDiskMergeImporter.BufferPoolfills anArrayBlockingQueuesized for exactly the buffers it allocates, and ignored the result ofoffer().add()says the refusal is impossible and throws if that ever stops being true.java/unknown-javadoc-parameter(1) —DeleteIndexTask.getConfigCommandLineName()documented anindexparameter it does not take.Nineteen alerts left, and why
Provably wrong (5).
FixedTimeRotationPolicyparsestime-of-dayvalues, but the configuration definition constrains them with^(([0-1][0-9])|([2][0-3]))([0-5][0-9])$, so what reachesInteger.valueOf()is always four digits.CtsAccessTokenResolverparsesexpireTimeinside a promise chain which ends inthenCatchRuntimeException()and turns anyNumberFormatExceptioninto anAccessTokenExceptioncarryingERR_OAUTH2_CTS_TOKEN_RESOLUTION— no exception escapes.LDAPPassThroughAuthenticationPolicyFactoryandLDAPConnectionFactoryare reported for ignoringoffer(), but both queues areConcurrentLinkedQueue, which is unbounded and whoseoffer()always returnstrue.A migration rather than a fix (14). The remaining
java/deprecated-callalerts are calls into deprecated internal APIs whose replacements need aServerContextthreaded through the legacy configuration layer:DirectoryServer.getConfigEntry()(9, in the backends and the two configuration managers),ChangelogBackend.getInstance()(2),CoreConfigManager.isAllowAttributeNameExceptions()(2). Moving them belongs with the configuration-layer work, not with a cleanup pass. The last one,Subject.getSubject()inJMXMBean, cannot be fixed at all on this baseline: the replacement,Subject.current(), is Java 18 and up.Testing
opendj-core8182 tests,opendj-cli46,opendj-server3 — all passing; they coverLDIFChangeRecordReader,ConsoleApplicationandProductInformation.opendj-server-legacy(-Pprecommit): the whole oforg.opends.server.tools.**andorg.opends.quicksetup.**together withRfc5808TestCase, which drives the transaction extended operations whose decoder changed, andImportLDIFTestCase, which exercises the on-disk merge importer — 448 tests, all passing.