Skip to content

Fix CodeQL note-level Java cleanups - #212

Open
vharseko wants to merge 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:fix-codeql-notes-java-cleanups
Open

vharseko wants to merge 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:fix-codeql-notes-java-cleanups

Conversation

@vharseko

Copy link
Copy Markdown
Member

Summary

Second note-level CodeQL batch: the mechanical Java cleanups — 52 alerts across 30 files, no behaviour change. Every edit is compiler-checked (a static nested class cannot reach the enclosing instance; a removed local cannot be read).

Rule Count Change
java/inefficient-boxed-constructor 9 new Long/Byte/Character/Float/Integer(...)valueOf(...) (or the primitive passed straight to pad(long)) in InstanceState and ConnectorUtil. These constructors are deprecated for removal since JDK 16.
java/non-static-nested-class 13 static on nested classes that never use the enclosing instance: SQLBuilder.{Column,Table,Join,OrderBy}, RepoJobStore.{TriggerComparator,WaitingTriggers,AcquiredTriggers}, PostgreSQLTableHandler.JsonExtractPathQueryFilterVisitor, Queries.OrientQueryFilterVisitor, ConfigObjectService.ParsedId, ManagedObjectService.ManagedObjectSetRequestHandler, SystemAction.SystemTypeAction, AuthenticationService.SocialAuthModuleConfigFactory.
java/local-variable-is-never-read 13 Dead locals removed: Void result = future.get(), int val = executeUpdate() ×3, unused propertyTable / projectDir / studioUiEnabled / type / result, the two MSG constants left over from commented-out throws in AttributeInfoHelper (with the empty if around one of them), props in DelayedConfigHandler (the getPropertiesToEncrypt call is kept — it validates).
java/inefficient-empty-string-test 5 "".equals(x)x.isEmpty() where x is a String (JDBCRepoService, OrientDBRepoService ×3, ScriptRegistryService).
java/inconsistent-javadoc-throws 8 @throws removed where the method cannot throw it (AuditServiceImpl, ManagedObjectSet, MaintenanceService ×2, RepoJobStore ×4 — only the four flagged blocks; the other @throws ResourceException in that file are genuine).
java/unknown-javadoc-parameter 5 @param names aligned with the signatures (LinkType, ReconciliationContext, ReconFeeder, ReconStage); the orphaned javadoc of a commented-out method in OperationHelper removed.

Dismissed (6):

  • #704–#707 confusing-method-signature — public overloads used across modules (IdentityServer.initInstance, LogUtil.logAtLevel, the Disruptor onEvent handlers, AttributeInfoHelper.build); renaming would be a breaking change.
  • #440 non-static-nested-classZipArchive's constructor deliberately calls the enclosing resolveChecksumFile(), which UpdateManagerImplTest overrides as a test seam.
  • #435 inefficient-empty-string-testvalueAssertion is an Object; "".equals(...) is the right null-safe comparison there.

Deferred (1): #437 ResourceServlet:127 sits in the hunk #202 rewrites; it will follow once that PR lands.

Test plan

  • Suites of the 12 touched modules: cluster 3, provisioner-openicf 136, repo-jdbc 4, repo-orientdb 31, script 8, config 11, core 79, maintenance 115, security 18, authnfilter 37, quartz-fragment 8, audit 36 — 0 failures
  • CodeQL on this PR closes the alerts listed in the commit message

- Replace the deprecated boxed-type constructors with valueOf()
- Make the nested classes that never touch their enclosing instance static
- Remove locals that are assigned but never read (incl. two String
  constants left over from commented-out throws)
- Use String.isEmpty() instead of "".equals(...) on String values
- Fix javadoc: drop @throws for exceptions that cannot be thrown, align
  @PARAM names with the signatures, remove the javadoc of a commented-out
  method

Resolves CodeQL alerts OpenIdentityPlatform#26, OpenIdentityPlatform#29, OpenIdentityPlatform#31, OpenIdentityPlatform#32, OpenIdentityPlatform#35-OpenIdentityPlatform#38, OpenIdentityPlatform#43-OpenIdentityPlatform#46, OpenIdentityPlatform#51,
#422-#434, #436, #438, #439, #441-#451, #633-#645.
@vharseko vharseko added java Pull requests that update Java code refactor Code refactoring without behavior change documentation Documentation, javadoc, adoc, README, wiki repo Storage / repository layer (OrientDB, JDBC, HSQLDB) labels Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation, javadoc, adoc, README, wiki java Pull requests that update Java code refactor Code refactoring without behavior change repo Storage / repository layer (OrientDB, JDBC, HSQLDB)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant