Skip to content

Clean up remaining CodeQL deprecated-call alerts - #308

Merged
vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:codeql/deprecated-call-cleanup
Sep 25, 2026
Merged

vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:codeql/deprecated-call-cleanup

Conversation

@vharseko

@vharseko vharseko commented Sep 8, 2026

Copy link
Copy Markdown
Member

Clears the last three open CodeQL alerts on master. All of them are java/deprecated-call (severity note, no security severity) in maven-external-dependency-plugin:

Alert Location Deprecated API
#2020 ArtifactItem.java:365 StringUtils.defaultString
#391 ArtifactItem.java:360 StringUtils.defaultString
#2019 AbstractExternalDependencyMojo.java:176 IOUtil.close

Changes

  • ArtifactItem.toString() — replace the deprecated plexus-utils StringUtils.defaultString(version, "?") with Objects.toString(version, "?"). version is a String field, so the semantics are identical (null -> "?", otherwise the value itself).
  • AbstractExternalDependencyMojo.generatePomFile() — replace the deprecated IOUtil.close(writer) in the finally block with try-with-resources around WriterFactory.newXmlWriter(pomFile).

One behaviour change worth noting

IOUtil.close() swallowed any IOException thrown while closing. With try-with-resources, a failure while flushing or closing the temporary POM writer now propagates into the existing catch (IOException) and surfaces as MojoExecutionException, instead of leaving a silently truncated POM behind. That is the intended improvement, not a regression.

Verification

mvn --batch-mode -pl maven-external-dependency-plugin/maven-external-dependency-plugin clean compile passes. The files use CRLF line endings; the diff preserves them, so it stays at 7 insertions / 11 deletions.

After this merges, the repository has 0 open code scanning alerts.

All three open CodeQL alerts on master are java/deprecated-call in
maven-external-dependency-plugin:

- ArtifactItem.toString(): use Objects.toString(version, "?") instead of the
  deprecated plexus-utils StringUtils.defaultString(version, "?") — identical
  semantics for a String field.
- AbstractExternalDependencyMojo.generatePomFile(): use try-with-resources
  instead of the deprecated IOUtil.close(writer) in a finally block. Side
  effect: a failure while flushing or closing the temporary POM writer now
  surfaces as MojoExecutionException instead of being swallowed.

No other behaviour changes; the module compiles.
@vharseko vharseko added codeql CodeQL static-analysis findings refactoring Code cleanup / refactoring, no behavior change labels Sep 8, 2026
@vharseko
vharseko requested a review from maximthomas September 8, 2026 13:36
@vharseko
vharseko merged commit 5f68196 into OpenIdentityPlatform:master Sep 25, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codeql CodeQL static-analysis findings refactoring Code cleanup / refactoring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant