Skip to content

Log the throwable instead of its message, and escalate Slf4jDoNotLogMessageOfExceptionExplicitly to ERROR - #3611

Merged
dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:slf4j-log-throwable
Aug 14, 2026
Merged

dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:slf4j-log-throwable

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Aug 14, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #3610, which adopted the errorprone-slf4j plugin and left Slf4jDoNotLogMessageOfExceptionExplicitly at WARN with a 74-site backlog. This drains the backlog and moves the check to the plugin's default ERROR.

What was wrong

All 74 sites substituted the exception's message into the log text instead of passing the exception:

LOG.debug("Couldn't find cwd for pid {}: {}", getProcessID(), e.getMessage());

Passing the throwable is better on three counts:

  • The stack trace and cause chain reach the logs. A message line alone rarely locates the failure in a native call path.
  • getMessage() is null for exceptions constructed without one, so those sites logged the literal text null. A bare new IOException() is a real case here.
  • SLF4J defers rendering when the level is disabled, whereas getMessage() is evaluated at the call site regardless of level. Most of these are debug/trace in per-poll paths.

What changed

Where the trailing placeholder existed only to hold the exception text, it is dropped along with any separator left dangling in front of it:

LOG.debug("Couldn't find cwd for pid {}", getProcessID(), e);

Three shared format constants lost their trailing placeholder rather than being edited at each use: COM_EXCEPTION_MSG in oshi-common's WindowsSensors (shared by both Sensors twins) and COM_EXCEPTION_FMT in each WmiQueryHandler twin, covering eleven call sites between them.

AbstractNetworkIF built its InstantiationException from the SocketException's message and discarded the exception itself, so the stack trace getNetworks() now logs would have dead-ended there. It attaches the cause with initCause, since InstantiationException has no (String, Throwable) constructor.

The JNA and FFM twins moved together throughout.

Known remaining backlog, deliberately not in this PR

ExceptionUtil.logAtLevel — the shared dispatch behind getOrDefault/runOrLog/getOptional* — appends both t.getMessage() and t into an Object[] before dispatching:

Object[] all = Arrays.copyOf(args, args.length + 2);
all[args.length] = t.getMessage();
all[args.length + 1] = t;

These checks cannot see through an argument array, so none of its callers were reported, and escalating to ERROR does not catch them. The stack trace is never lost there (the throwable is passed), but the message text is reported twice and is still rendered when the level is disabled. 67 call sites across 21 files pass a message ending in {} to catch it inline; 59 others already omit the placeholder, so getMessage() lands as an unmatched extra argument that SLF4J discards. Changing that contract plus its callers is a different shape of change from this mechanical sweep, so it is left for a follow-up.

Verification

  • ./mvnw clean spotless:apply sortpom:sort checkstyle:check install forbiddenapis:check javadoc:javadoc - exit 0, 1559 tests successful, 0 failed.
  • ./mvnw clean install -DskipTests -Perror-prone - zero Error Prone output with the check at ERROR, so nothing was missed. A clean build is required to see these findings at all; an incremental one silently reports none.
  • Fork Linux CI green on all 8 jobs, including Error Prone and the SLF4J lint job.

Log output changes broadly, so unlike #3610 this carries a CHANGELOG entry. The behavior is only reachable through consumers' logging configuration; no API changes.

Summary by CodeRabbit

  • Bug Fixes

    • Improved diagnostic logging across supported platforms by preserving complete exception details and stack traces.
    • Network-interface creation errors now retain their original underlying cause.
    • Existing fallback and error-handling behavior remains unchanged.
  • Chores

    • Strengthened logging checks to prevent future message-only exception logging.
  • Documentation

    • Added release notes for version 7.5.0.

…RROR

The errorprone-slf4j check Slf4jDoNotLogMessageOfExceptionExplicitly was
adopted at WARN in #3610 with a 74-site backlog left to drain. This drains
it and moves the check to the plugin's default ERROR severity.

Every one of the 74 log statements substituted the exception's message into
the log text instead of passing the exception itself. Passing the throwable
is better on three counts: the stack trace and cause chain reach the logs
rather than a single message line; getMessage() returns null for exceptions
constructed without one, which logged the literal text "null"; and SLF4J
defers all rendering when the level is disabled, whereas getMessage() is
evaluated at the call site regardless.

Where the message ended in a placeholder that only existed to hold the
exception text, the placeholder is dropped along with any separator left
dangling in front of it. Three shared format constants (COM_EXCEPTION_MSG in
oshi-common, shared by both Sensors twins, and COM_EXCEPTION_FMT in each
WmiQueryHandler twin) lost their trailing placeholder instead, covering
eleven call sites between them.

AbstractNetworkIF built its InstantiationException from the SocketException's
message and discarded the exception, so the stack trace getNetworks() now
logs would have stopped there. It attaches the cause via initCause, since
InstantiationException has no (String, Throwable) constructor.

ExceptionUtil.logAtLevel appends both t.getMessage() and t to an Object[]
before dispatching, which these checks cannot see through, so its callers
are untouched here and left for a follow-up.
@coderabbitai

coderabbitai Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4124cb83-fb91-4be1-9657-be8f84a437d5

📥 Commits

Reviewing files that changed from the base of the PR and between 5ae99f4 and 47e6eaa.

📒 Files selected for processing (47)
  • CHANGELOG.md
  • oshi-common/src/main/java/oshi/hardware/common/AbstractNetworkIF.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsGpuStats.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsSensors.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxFileSystem.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/AbstractProcOSProcess.java
  • oshi-common/src/main/java/oshi/spi/SystemInfoFactory.java
  • oshi-common/src/main/java/oshi/util/ExecutingCommand.java
  • oshi-common/src/main/java/oshi/util/FileUtil.java
  • oshi-common/src/main/java/oshi/util/PrivilegedUtil.java
  • oshi-common/src/main/java/oshi/util/Util.java
  • oshi-core-ffm/src/main/java/oshi/driver/windows/registry/HkeyUserDataFFM.java
  • oshi-core-ffm/src/main/java/oshi/driver/windows/registry/InstalledAppsDataFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/common/NvmlFunctions.java
  • oshi-core-ffm/src/main/java/oshi/ffm/platform/windows/DxgiFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/gpu/AdlUtilFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/PerfDataUtilFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/WmiQueryHandlerFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsCentralProcessorFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsGraphicsCardFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsSensorsFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsSoundCardFFM.java
  • oshi-core-ffm/src/main/java/oshi/software/os/linux/LinuxNetworkParamsFFM.java
  • oshi-core-ffm/src/main/java/oshi/software/os/mac/MacNetworkParamsFFM.java
  • oshi-core/src/main/java/oshi/driver/windows/registry/HkeyUserData.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsGraphicsCardJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsSensorsJNA.java
  • oshi-core/src/main/java/oshi/jna/platform/windows/Dxgi.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxFileSystemJNA.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxNetworkParamsJNA.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystemJNA.java
  • oshi-core/src/main/java/oshi/software/os/mac/MacNetworkParamsJNA.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsOSProcessJNA.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsOperatingSystemJNA.java
  • oshi-core/src/main/java/oshi/util/gpu/AdlUtilJNA.java
  • oshi-core/src/main/java/oshi/util/gpu/NvmlUtilJNA.java
  • oshi-core/src/main/java/oshi/util/platform/unix/solaris/KstatUtil.java
  • oshi-core/src/main/java/oshi/util/platform/windows/PerfCounterWildcardQuery.java
  • oshi-core/src/main/java/oshi/util/platform/windows/RegistryUtil.java
  • oshi-core/src/main/java/oshi/util/platform/windows/WmiQueryHandler.java
  • oshi-demo/src/main/java/oshi/demo/OshiHTTPServer.java
  • pom.xml
📜 Recent review details
⏰ Context from checks skipped due to timeout. (11)
  • GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
  • GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
  • GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Test JDK 26, ubuntu-latest
  • GitHub Check: Error Prone
  • GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
  • GitHub Check: Lint (ForbiddenAPIs, Javadoc, SLF4J)
  • GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
  • GitHub Check: Lint (Spotless, Checkstyle)
  • GitHub Check: Analyze (java)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{java,properties}

📄 CodeRabbit inference engine (AGENTS.md)

Before writing any parsing helper, check whether ParseUtil already has one.

Files:

  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsSensorsJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreJNA.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxFileSystemJNA.java
  • oshi-core/src/main/java/oshi/software/os/mac/MacNetworkParamsJNA.java
  • oshi-core/src/main/java/oshi/util/platform/windows/RegistryUtil.java
  • oshi-common/src/main/java/oshi/spi/SystemInfoFactory.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxNetworkParamsJNA.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsSensorsFFM.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystemJNA.java
  • oshi-common/src/main/java/oshi/util/Util.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/AbstractProcOSProcess.java
  • oshi-core-ffm/src/main/java/oshi/driver/windows/registry/InstalledAppsDataFFM.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsOSProcessJNA.java
  • oshi-common/src/main/java/oshi/util/PrivilegedUtil.java
  • oshi-core-ffm/src/main/java/oshi/ffm/common/NvmlFunctions.java
  • oshi-core/src/main/java/oshi/util/gpu/NvmlUtilJNA.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsCentralProcessorFFM.java
  • oshi-core/src/main/java/oshi/jna/platform/windows/Dxgi.java
  • oshi-core-ffm/src/main/java/oshi/driver/windows/registry/HkeyUserDataFFM.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsGraphicsCardJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupJNA.java
  • oshi-demo/src/main/java/oshi/demo/OshiHTTPServer.java
  • oshi-core/src/main/java/oshi/util/platform/unix/solaris/KstatUtil.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsGraphicsCardFFM.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsGpuStats.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/gpu/AdlUtilFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/platform/windows/DxgiFFM.java
  • oshi-core/src/main/java/oshi/util/platform/windows/WmiQueryHandler.java
  • oshi-core/src/main/java/oshi/util/platform/windows/PerfCounterWildcardQuery.java
  • oshi-common/src/main/java/oshi/hardware/common/AbstractNetworkIF.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsOperatingSystemJNA.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/WmiQueryHandlerFFM.java
  • oshi-common/src/main/java/oshi/util/ExecutingCommand.java
  • oshi-core-ffm/src/main/java/oshi/software/os/mac/MacNetworkParamsFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreFFM.java
  • oshi-core-ffm/src/main/java/oshi/software/os/linux/LinuxNetworkParamsFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/PerfDataUtilFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsSoundCardFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupFFM.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsSensors.java
  • oshi-core/src/main/java/oshi/driver/windows/registry/HkeyUserData.java
  • oshi-common/src/main/java/oshi/util/FileUtil.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxFileSystem.java
  • oshi-core/src/main/java/oshi/util/gpu/AdlUtilJNA.java
**/*.java

📄 CodeRabbit inference engine (AGENTS.md)

**/*.java: Every public and protected type and method needs javadoc.
Do not use fully-qualified class names in
code or in javadoc — including inside {@link ...}. Import the type and link the simple name.
New files get a current-year-only
header (Copyright 2026 The OSHI Project Contributors / SPDX-License-Identifier: MIT), even when
copied from an older file; spotless maintains end years on existing files.
Never add a line range to
config/checkstyle-suppressions.xml — a range breaks the moment anything above it shifts, including a
single added import, and the failure looks unrelated to the change that caused it.
new classes are
expected to declare one, and matching the annotation of the class you are modeling yours on is the
right default.
Values that are constant (CPU model,
serial number) or expensive-but-slow-changing are wrapped in
oshi.util.Memoizer.memoize(supplier, ...)

Files:

  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsSensorsJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreJNA.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxFileSystemJNA.java
  • oshi-core/src/main/java/oshi/software/os/mac/MacNetworkParamsJNA.java
  • oshi-core/src/main/java/oshi/util/platform/windows/RegistryUtil.java
  • oshi-common/src/main/java/oshi/spi/SystemInfoFactory.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxNetworkParamsJNA.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsSensorsFFM.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystemJNA.java
  • oshi-common/src/main/java/oshi/util/Util.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/AbstractProcOSProcess.java
  • oshi-core-ffm/src/main/java/oshi/driver/windows/registry/InstalledAppsDataFFM.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsOSProcessJNA.java
  • oshi-common/src/main/java/oshi/util/PrivilegedUtil.java
  • oshi-core-ffm/src/main/java/oshi/ffm/common/NvmlFunctions.java
  • oshi-core/src/main/java/oshi/util/gpu/NvmlUtilJNA.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsCentralProcessorFFM.java
  • oshi-core/src/main/java/oshi/jna/platform/windows/Dxgi.java
  • oshi-core-ffm/src/main/java/oshi/driver/windows/registry/HkeyUserDataFFM.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsGraphicsCardJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupJNA.java
  • oshi-demo/src/main/java/oshi/demo/OshiHTTPServer.java
  • oshi-core/src/main/java/oshi/util/platform/unix/solaris/KstatUtil.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsGraphicsCardFFM.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsGpuStats.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/gpu/AdlUtilFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/platform/windows/DxgiFFM.java
  • oshi-core/src/main/java/oshi/util/platform/windows/WmiQueryHandler.java
  • oshi-core/src/main/java/oshi/util/platform/windows/PerfCounterWildcardQuery.java
  • oshi-common/src/main/java/oshi/hardware/common/AbstractNetworkIF.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsOperatingSystemJNA.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/WmiQueryHandlerFFM.java
  • oshi-common/src/main/java/oshi/util/ExecutingCommand.java
  • oshi-core-ffm/src/main/java/oshi/software/os/mac/MacNetworkParamsFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreFFM.java
  • oshi-core-ffm/src/main/java/oshi/software/os/linux/LinuxNetworkParamsFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/PerfDataUtilFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsSoundCardFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupFFM.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsSensors.java
  • oshi-core/src/main/java/oshi/driver/windows/registry/HkeyUserData.java
  • oshi-common/src/main/java/oshi/util/FileUtil.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxFileSystem.java
  • oshi-core/src/main/java/oshi/util/gpu/AdlUtilJNA.java
oshi-common/**/*.java

📄 CodeRabbit inference engine (AGENTS.md)

oshi-common/**/*.java: oshi-common may not reference com.sun.jna.**, java.lang.foreign.**, or any
System.load/loadLibrary. It must stay pure JDK.

Files:

  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java
  • oshi-common/src/main/java/oshi/spi/SystemInfoFactory.java
  • oshi-common/src/main/java/oshi/util/Util.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/AbstractProcOSProcess.java
  • oshi-common/src/main/java/oshi/util/PrivilegedUtil.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsGpuStats.java
  • oshi-common/src/main/java/oshi/hardware/common/AbstractNetworkIF.java
  • oshi-common/src/main/java/oshi/util/ExecutingCommand.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsSensors.java
  • oshi-common/src/main/java/oshi/util/FileUtil.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxFileSystem.java
oshi-core-ffm/**/*.java

📄 CodeRabbit inference engine (AGENTS.md)

oshi-core-ffm may not reference com.sun.jna.**.

Files:

  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsSensorsFFM.java
  • oshi-core-ffm/src/main/java/oshi/driver/windows/registry/InstalledAppsDataFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/common/NvmlFunctions.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsCentralProcessorFFM.java
  • oshi-core-ffm/src/main/java/oshi/driver/windows/registry/HkeyUserDataFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsGraphicsCardFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/gpu/AdlUtilFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/platform/windows/DxgiFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/WmiQueryHandlerFFM.java
  • oshi-core-ffm/src/main/java/oshi/software/os/mac/MacNetworkParamsFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreFFM.java
  • oshi-core-ffm/src/main/java/oshi/software/os/linux/LinuxNetworkParamsFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/PerfDataUtilFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsSoundCardFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupFFM.java
🧠 Learnings (6)
📚 Learning: 2026-04-06T04:45:47.644Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3121
File: oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystem.java:53-53
Timestamp: 2026-04-06T04:45:47.644Z
Learning: In the oshi/oshi project, only interfaces and classes in the root packages `oshi`, `oshi.hardware`, and `oshi.software.os` are considered the public API. Code in subpackages that represent specific implementations/platforms (e.g., `oshi.software.os.linux`, `oshi.hardware.platform.linux`, and similar subpackages) is implementation detail. When reviewing, do not treat changes to classes in these platform-specific subpackages as public API breaks (for example: making `LinuxOperatingSystem` abstract, narrowing constructor visibility, or adding/removing abstract methods should not be flagged as breaking public API).

Applied to files:

  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsSensorsJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreJNA.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxFileSystemJNA.java
  • oshi-core/src/main/java/oshi/software/os/mac/MacNetworkParamsJNA.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxNetworkParamsJNA.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystemJNA.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsOSProcessJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsGraphicsCardJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupJNA.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsOperatingSystemJNA.java
📚 Learning: 2026-07-06T19:25:59.225Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3432
File: oshi-common/src/main/java/oshi/util/ExceptionUtil.java:26-56
Timestamp: 2026-07-06T19:25:59.225Z
Learning: In this repo’s SLF4J 1.x-compatible logging code, do not flag cases where a logger call uses SLF4J 1.6+ implicit-cause handling—e.g., `log.error("...{}", value, t)` (or similar with a single `{}` placeholder) where `t` is passed as the final/trailing argument. SLF4J will attach `t` as the log event’s cause with the full stack trace; this is equivalent to SLF4J 2.x’s fluent `atLevel(...).setCause(t).log(...)` and is intentionally used to preserve SLF4J 1.x runtime compatibility.

Applied to files:

  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsSensorsJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreJNA.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxFileSystemJNA.java
  • oshi-core/src/main/java/oshi/software/os/mac/MacNetworkParamsJNA.java
  • oshi-core/src/main/java/oshi/util/platform/windows/RegistryUtil.java
  • oshi-common/src/main/java/oshi/spi/SystemInfoFactory.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxNetworkParamsJNA.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsSensorsFFM.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystemJNA.java
  • oshi-common/src/main/java/oshi/util/Util.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/AbstractProcOSProcess.java
  • oshi-core-ffm/src/main/java/oshi/driver/windows/registry/InstalledAppsDataFFM.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsOSProcessJNA.java
  • oshi-common/src/main/java/oshi/util/PrivilegedUtil.java
  • oshi-core-ffm/src/main/java/oshi/ffm/common/NvmlFunctions.java
  • oshi-core/src/main/java/oshi/util/gpu/NvmlUtilJNA.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsCentralProcessorFFM.java
  • oshi-core/src/main/java/oshi/jna/platform/windows/Dxgi.java
  • oshi-core-ffm/src/main/java/oshi/driver/windows/registry/HkeyUserDataFFM.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsGraphicsCardJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupJNA.java
  • oshi-demo/src/main/java/oshi/demo/OshiHTTPServer.java
  • oshi-core/src/main/java/oshi/util/platform/unix/solaris/KstatUtil.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsGraphicsCardFFM.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsGpuStats.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/gpu/AdlUtilFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/platform/windows/DxgiFFM.java
  • oshi-core/src/main/java/oshi/util/platform/windows/WmiQueryHandler.java
  • oshi-core/src/main/java/oshi/util/platform/windows/PerfCounterWildcardQuery.java
  • oshi-common/src/main/java/oshi/hardware/common/AbstractNetworkIF.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsOperatingSystemJNA.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/WmiQueryHandlerFFM.java
  • oshi-common/src/main/java/oshi/util/ExecutingCommand.java
  • oshi-core-ffm/src/main/java/oshi/software/os/mac/MacNetworkParamsFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreFFM.java
  • oshi-core-ffm/src/main/java/oshi/software/os/linux/LinuxNetworkParamsFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/PerfDataUtilFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsSoundCardFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupFFM.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsSensors.java
  • oshi-core/src/main/java/oshi/driver/windows/registry/HkeyUserData.java
  • oshi-common/src/main/java/oshi/util/FileUtil.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxFileSystem.java
  • oshi-core/src/main/java/oshi/util/gpu/AdlUtilJNA.java
📚 Learning: 2026-07-30T00:35:22.638Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3547
File: oshi-common/src/main/java/oshi/hardware/common/platform/unix/BsdFirmware.java:82-82
Timestamp: 2026-07-30T00:35:22.638Z
Learning: In OSHI, treat changes as “API-breaking” only when they affect classes (or relevant API surface) annotated with `PublicAPI`. Public classes/members that are not annotated with `PublicAPI` should be reviewed as internal implementation details, even if they are public (e.g., classes like `oshi.hardware.common.platform.unix.BsdFirmware`). Also, respect intentional visibility decisions used for tests—e.g., methods like `BsdFirmware.parseDmesg(List<String>)` may be intentionally package-private to support tests within the same package; avoid widening visibility or altering signatures unless the related `PublicAPI` contract requires it.

Applied to files:

  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsSensorsJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreJNA.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxFileSystemJNA.java
  • oshi-core/src/main/java/oshi/software/os/mac/MacNetworkParamsJNA.java
  • oshi-core/src/main/java/oshi/util/platform/windows/RegistryUtil.java
  • oshi-common/src/main/java/oshi/spi/SystemInfoFactory.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxNetworkParamsJNA.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsSensorsFFM.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystemJNA.java
  • oshi-common/src/main/java/oshi/util/Util.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/AbstractProcOSProcess.java
  • oshi-core-ffm/src/main/java/oshi/driver/windows/registry/InstalledAppsDataFFM.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsOSProcessJNA.java
  • oshi-common/src/main/java/oshi/util/PrivilegedUtil.java
  • oshi-core-ffm/src/main/java/oshi/ffm/common/NvmlFunctions.java
  • oshi-core/src/main/java/oshi/util/gpu/NvmlUtilJNA.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsCentralProcessorFFM.java
  • oshi-core/src/main/java/oshi/jna/platform/windows/Dxgi.java
  • oshi-core-ffm/src/main/java/oshi/driver/windows/registry/HkeyUserDataFFM.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsGraphicsCardJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupJNA.java
  • oshi-demo/src/main/java/oshi/demo/OshiHTTPServer.java
  • oshi-core/src/main/java/oshi/util/platform/unix/solaris/KstatUtil.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsGraphicsCardFFM.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsGpuStats.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/gpu/AdlUtilFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/platform/windows/DxgiFFM.java
  • oshi-core/src/main/java/oshi/util/platform/windows/WmiQueryHandler.java
  • oshi-core/src/main/java/oshi/util/platform/windows/PerfCounterWildcardQuery.java
  • oshi-common/src/main/java/oshi/hardware/common/AbstractNetworkIF.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsOperatingSystemJNA.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/WmiQueryHandlerFFM.java
  • oshi-common/src/main/java/oshi/util/ExecutingCommand.java
  • oshi-core-ffm/src/main/java/oshi/software/os/mac/MacNetworkParamsFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreFFM.java
  • oshi-core-ffm/src/main/java/oshi/software/os/linux/LinuxNetworkParamsFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/PerfDataUtilFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsSoundCardFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupFFM.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsSensors.java
  • oshi-core/src/main/java/oshi/driver/windows/registry/HkeyUserData.java
  • oshi-common/src/main/java/oshi/util/FileUtil.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxFileSystem.java
  • oshi-core/src/main/java/oshi/util/gpu/AdlUtilJNA.java
📚 Learning: 2026-08-03T00:46:14.953Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3566
File: oshi-common/src/main/java/oshi/software/common/os/unix/openbsd/OpenBsdNetworkParams.java:18-22
Timestamp: 2026-08-03T00:46:14.953Z
Learning: In the OSHI Java codebase, do not require duplicate Javadoc on public methods annotated with Override when the inherited Javadoc from the parent declaration adequately documents the method. The general public-member Javadoc requirement should not flag these overrides solely because they lack redundant documentation.

Applied to files:

  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsSensorsJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreJNA.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxFileSystemJNA.java
  • oshi-core/src/main/java/oshi/software/os/mac/MacNetworkParamsJNA.java
  • oshi-core/src/main/java/oshi/util/platform/windows/RegistryUtil.java
  • oshi-common/src/main/java/oshi/spi/SystemInfoFactory.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxNetworkParamsJNA.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsSensorsFFM.java
  • oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystemJNA.java
  • oshi-common/src/main/java/oshi/util/Util.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/AbstractProcOSProcess.java
  • oshi-core-ffm/src/main/java/oshi/driver/windows/registry/InstalledAppsDataFFM.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsOSProcessJNA.java
  • oshi-common/src/main/java/oshi/util/PrivilegedUtil.java
  • oshi-core-ffm/src/main/java/oshi/ffm/common/NvmlFunctions.java
  • oshi-core/src/main/java/oshi/util/gpu/NvmlUtilJNA.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsCentralProcessorFFM.java
  • oshi-core/src/main/java/oshi/jna/platform/windows/Dxgi.java
  • oshi-core-ffm/src/main/java/oshi/driver/windows/registry/HkeyUserDataFFM.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsGraphicsCardJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupJNA.java
  • oshi-demo/src/main/java/oshi/demo/OshiHTTPServer.java
  • oshi-core/src/main/java/oshi/util/platform/unix/solaris/KstatUtil.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsGraphicsCardFFM.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsGpuStats.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/gpu/AdlUtilFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/platform/windows/DxgiFFM.java
  • oshi-core/src/main/java/oshi/util/platform/windows/WmiQueryHandler.java
  • oshi-core/src/main/java/oshi/util/platform/windows/PerfCounterWildcardQuery.java
  • oshi-common/src/main/java/oshi/hardware/common/AbstractNetworkIF.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsOperatingSystemJNA.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/WmiQueryHandlerFFM.java
  • oshi-common/src/main/java/oshi/util/ExecutingCommand.java
  • oshi-core-ffm/src/main/java/oshi/software/os/mac/MacNetworkParamsFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreFFM.java
  • oshi-core-ffm/src/main/java/oshi/software/os/linux/LinuxNetworkParamsFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/PerfDataUtilFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsSoundCardFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupFFM.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsSensors.java
  • oshi-core/src/main/java/oshi/driver/windows/registry/HkeyUserData.java
  • oshi-common/src/main/java/oshi/util/FileUtil.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxFileSystem.java
  • oshi-core/src/main/java/oshi/util/gpu/AdlUtilJNA.java
📚 Learning: 2026-04-12T19:22:09.716Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:22:09.716Z
Learning: When reviewing OSHI hardware platform code that uses or implements `CentralProcessor`/`PhysicalProcessor.getEfficiency()`, remember the API’s counterintuitive semantics: a *higher* efficiency-class value indicates *greater performance* (lower efficiency). P-cores/“performance cores” should therefore have higher values (e.g., 1) than E-cores/“efficiency cores” (e.g., 0), as documented in the `CentralProcessor` Javadoc. Do not flag code as incorrect solely because ARM_P_CORES or Intel P-cores are assigned higher efficiency values.

Applied to files:

  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java
  • oshi-common/src/main/java/oshi/spi/SystemInfoFactory.java
  • oshi-common/src/main/java/oshi/util/Util.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/AbstractProcOSProcess.java
  • oshi-common/src/main/java/oshi/util/PrivilegedUtil.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsGpuStats.java
  • oshi-common/src/main/java/oshi/hardware/common/AbstractNetworkIF.java
  • oshi-common/src/main/java/oshi/util/ExecutingCommand.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsSensors.java
  • oshi-common/src/main/java/oshi/util/FileUtil.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxFileSystem.java
📚 Learning: 2026-08-02T23:56:23.866Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3565
File: oshi-core-ffm/src/main/java/oshi/ffm/platform/unix/PosixLibcFunctions.java:51-56
Timestamp: 2026-08-02T23:56:23.866Z
Learning: For Java FFM bindings in the oshi-core-ffm module, assume a 64-bit JVM and 64-bit operating system. Do not flag 32-bit native ABI or memory-layout compatibility concerns, consistent with the project's JDK 25 support policy, unless that policy changes.

Applied to files:

  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsSensorsFFM.java
  • oshi-core-ffm/src/main/java/oshi/driver/windows/registry/InstalledAppsDataFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/common/NvmlFunctions.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsCentralProcessorFFM.java
  • oshi-core-ffm/src/main/java/oshi/driver/windows/registry/HkeyUserDataFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsGraphicsCardFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/gpu/AdlUtilFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/platform/windows/DxgiFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/WmiQueryHandlerFFM.java
  • oshi-core-ffm/src/main/java/oshi/software/os/mac/MacNetworkParamsFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreFFM.java
  • oshi-core-ffm/src/main/java/oshi/software/os/linux/LinuxNetworkParamsFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/PerfDataUtilFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsSoundCardFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupFFM.java
🪛 PMD (7.26.0)
oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreJNA.java

[Low] 85-85: InvalidLogMessageFormat (Error Prone): Too many arguments, expected 0 argument but found 1

(InvalidLogMessageFormat (Error Prone))

oshi-core/src/main/java/oshi/util/platform/windows/RegistryUtil.java

[Low] 71-71: InvalidLogMessageFormat (Error Prone): Too many arguments, expected 2 arguments but found 3

(InvalidLogMessageFormat (Error Prone))

oshi-core-ffm/src/main/java/oshi/driver/windows/registry/InstalledAppsDataFFM.java

[Low] 121-121: InvalidLogMessageFormat (Error Prone): Too many arguments, expected 2 arguments but found 3

(InvalidLogMessageFormat (Error Prone))

oshi-core/src/main/java/oshi/software/os/windows/WindowsOSProcessJNA.java

[Low] 215-215: InvalidLogMessageFormat (Error Prone): Too many arguments, expected 3 arguments but found 4

(InvalidLogMessageFormat (Error Prone))

oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupJNA.java

[Low] 53-53: InvalidLogMessageFormat (Error Prone): Too many arguments, expected 0 argument but found 1

(InvalidLogMessageFormat (Error Prone))

oshi-core/src/main/java/oshi/util/platform/unix/solaris/KstatUtil.java

[Low] 278-278: InvalidLogMessageFormat (Error Prone): Too many arguments, expected 2 arguments but found 3

(InvalidLogMessageFormat (Error Prone))


[Low] 328-328: InvalidLogMessageFormat (Error Prone): Too many arguments, expected 1 argument but found 2

(InvalidLogMessageFormat (Error Prone))

oshi-core/src/main/java/oshi/util/platform/windows/WmiQueryHandler.java

[Low] 210-210: InvalidLogMessageFormat (Error Prone): Too many arguments, expected 2 arguments but found 3

(InvalidLogMessageFormat (Error Prone))


[Low] 212-212: InvalidLogMessageFormat (Error Prone): Too many arguments, expected 2 arguments but found 3

(InvalidLogMessageFormat (Error Prone))

oshi-core/src/main/java/oshi/util/platform/windows/PerfCounterWildcardQuery.java

[Low] 153-154: InvalidLogMessageFormat (Error Prone): Too many arguments, expected 1 argument but found 2

(InvalidLogMessageFormat (Error Prone))

oshi-core/src/main/java/oshi/software/os/windows/WindowsOperatingSystemJNA.java

[Low] 373-373: InvalidLogMessageFormat (Error Prone): Too many arguments, expected 0 argument but found 1

(InvalidLogMessageFormat (Error Prone))

oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/WmiQueryHandlerFFM.java

[Low] 427-427: InvalidLogMessageFormat (Error Prone): Too many arguments, expected 2 arguments but found 3

(InvalidLogMessageFormat (Error Prone))


[Low] 429-429: InvalidLogMessageFormat (Error Prone): Too many arguments, expected 2 arguments but found 3

(InvalidLogMessageFormat (Error Prone))

oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreFFM.java

[Low] 90-90: InvalidLogMessageFormat (Error Prone): Too many arguments, expected 0 argument but found 1

(InvalidLogMessageFormat (Error Prone))

oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupFFM.java

[Low] 52-52: InvalidLogMessageFormat (Error Prone): Too many arguments, expected 0 argument but found 1

(InvalidLogMessageFormat (Error Prone))

oshi-core/src/main/java/oshi/driver/windows/registry/HkeyUserData.java

[Low] 87-87: InvalidLogMessageFormat (Error Prone): Too many arguments, expected 1 argument but found 2

(InvalidLogMessageFormat (Error Prone))

🔇 Additional comments (48)
CHANGELOG.md (1)

6-6: LGTM!

oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/WmiQueryHandlerFFM.java (1)

65-65: LGTM!

Also applies to: 231-231, 378-378, 427-429

oshi-core/src/main/java/oshi/util/platform/windows/WmiQueryHandler.java (1)

60-60: LGTM!

Also applies to: 210-212

oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsGpuStats.java (1)

272-272: LGTM!

Also applies to: 308-308, 502-502

oshi-common/src/main/java/oshi/spi/SystemInfoFactory.java (1)

62-62: LGTM!

oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsSensorsFFM.java (1)

62-62: LGTM!

oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsSoundCardFFM.java (1)

49-49: LGTM!

Also applies to: 68-68

oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsSensorsJNA.java (1)

63-63: LGTM!

oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystemJNA.java (1)

189-189: LGTM!

oshi-core/src/main/java/oshi/software/os/windows/WindowsOperatingSystemJNA.java (1)

373-373: LGTM!

oshi-core/src/main/java/oshi/util/gpu/AdlUtilJNA.java (1)

82-82: LGTM!

oshi-core/src/main/java/oshi/util/platform/windows/RegistryUtil.java (1)

71-71: LGTM!

oshi-common/src/main/java/oshi/hardware/common/AbstractNetworkIF.java (1)

130-134: LGTM!

Also applies to: 181-181

oshi-common/src/main/java/oshi/software/common/os/linux/LinuxFileSystem.java (1)

122-122: LGTM!

Also applies to: 140-140, 223-223, 310-310

oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java (1)

157-157: LGTM!

oshi-common/src/main/java/oshi/software/common/os/unix/AbstractProcOSProcess.java (1)

98-98: LGTM!

oshi-common/src/main/java/oshi/util/ExecutingCommand.java (1)

87-87: LGTM!

Also applies to: 107-109

oshi-common/src/main/java/oshi/util/FileUtil.java (1)

79-81: LGTM!

Also applies to: 131-133, 160-162, 332-332

oshi-common/src/main/java/oshi/util/PrivilegedUtil.java (1)

302-302: LGTM!

oshi-common/src/main/java/oshi/util/Util.java (1)

54-54: LGTM!

oshi-core/src/main/java/oshi/software/os/windows/WindowsOSProcessJNA.java (1)

215-215: LGTM!

oshi-core/src/main/java/oshi/util/gpu/NvmlUtilJNA.java (1)

68-68: LGTM!

oshi-core/src/main/java/oshi/util/platform/unix/solaris/KstatUtil.java (1)

278-278: LGTM!

Also applies to: 328-328

oshi-demo/src/main/java/oshi/demo/OshiHTTPServer.java (1)

72-72: LGTM!

Also applies to: 139-145

oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsSensors.java (2)

141-153: LGTM!

Also applies to: 273-273, 300-302


36-38: 🗄️ Data Integrity & Integration

All COM_EXCEPTION_MSG consumers pass the caught exception.

oshi-core-ffm/src/main/java/oshi/software/os/linux/LinuxNetworkParamsFFM.java (1)

49-49: LGTM!

oshi-core-ffm/src/main/java/oshi/software/os/mac/MacNetworkParamsFFM.java (1)

50-50: LGTM!

oshi-core/src/main/java/oshi/driver/windows/registry/HkeyUserData.java (1)

87-87: LGTM!

oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreJNA.java (1)

85-85: LGTM!

oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupJNA.java (1)

53-53: LGTM!

oshi-core/src/main/java/oshi/jna/platform/windows/Dxgi.java (1)

91-93: LGTM!

oshi-core/src/main/java/oshi/software/os/linux/LinuxFileSystemJNA.java (1)

37-37: LGTM!

oshi-core/src/main/java/oshi/software/os/linux/LinuxNetworkParamsJNA.java (1)

44-44: LGTM!

oshi-core/src/main/java/oshi/software/os/mac/MacNetworkParamsJNA.java (1)

44-44: LGTM!

oshi-core/src/main/java/oshi/util/platform/windows/PerfCounterWildcardQuery.java (1)

153-154: LGTM!

pom.xml (1)

1263-1267: LGTM!

oshi-core-ffm/src/main/java/oshi/driver/windows/registry/HkeyUserDataFFM.java (1)

98-98: LGTM!

oshi-core-ffm/src/main/java/oshi/driver/windows/registry/InstalledAppsDataFFM.java (1)

121-121: LGTM!

oshi-core-ffm/src/main/java/oshi/ffm/common/NvmlFunctions.java (1)

126-126: LGTM!

oshi-core-ffm/src/main/java/oshi/ffm/platform/windows/DxgiFFM.java (1)

65-65: LGTM!

oshi-core-ffm/src/main/java/oshi/ffm/util/gpu/AdlUtilFFM.java (1)

141-141: LGTM!

oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/PerfDataUtilFFM.java (1)

326-326: LGTM!

Also applies to: 342-342

oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsCentralProcessorFFM.java (1)

127-127: LGTM!

oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsGraphicsCardFFM.java (1)

148-148: LGTM!

Also applies to: 191-191

oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsHWDiskStoreFFM.java (1)

90-90: LGTM!

oshi-core-ffm/src/main/java/oshi/hardware/platform/windows/WindowsLogicalVolumeGroupFFM.java (1)

52-52: LGTM!

oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsGraphicsCardJNA.java (1)

282-282: LGTM!


📝 Walkthrough

Walkthrough

The change standardizes exception logging across OSHI modules. Logging calls now pass throwable objects directly to SLF4J. AbstractNetworkIF also preserves the original SocketException as the cause of its InstantiationException.

Changes

Exception logging standardization

Layer / File(s) Summary
Exception cause and logging contract
CHANGELOG.md, oshi-common/.../AbstractNetworkIF.java, oshi-common/.../WindowsSensors.java, oshi-core*/.../WmiQueryHandler*.java, pom.xml
Exception causes and logging formats now support direct throwable arguments. Error Prone treats message-only exception logging as an error.
Common module logging updates
oshi-common/src/main/java/oshi/...
Common utilities, filesystem code, process code, GPU statistics, and provider discovery now preserve throwable details in logs.
FFM backend logging updates
oshi-core-ffm/src/main/java/oshi/...
FFM registry, WMI, GPU, performance, graphics, sound, and network logging now passes exceptions directly to SLF4J.
JNA and demo logging updates
oshi-core/src/main/java/oshi/..., oshi-demo/src/main/java/oshi/demo/OshiHTTPServer.java
JNA integrations and HTTP server error paths now retain throwable details without changing fallback or cleanup behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 47e6e

This change routes exceptions to logging so stack traces and causes are preserved without changing the public API; no actionable merge-blocking risk remains after normal checks and review.

Poem

I’m a rabbit with logs in my burrow tonight,
Stack traces now hop into debug light.
Causes stay joined, messages stand clear,
SLF4J catches each exception near.
Thump, thump—the warnings are bright!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 48.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: throwable-aware SLF4J logging and escalation of the Error Prone check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 15.55556% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.84%. Comparing base (5ae99f4) to head (47e6eaa).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...n/java/oshi/hardware/common/AbstractNetworkIF.java 0.00% 4 Missing ⚠️
...oshi/software/common/os/linux/LinuxFileSystem.java 0.00% 4 Missing ⚠️
oshi-common/src/main/java/oshi/util/FileUtil.java 42.85% 4 Missing ⚠️
...mmon/src/main/java/oshi/util/ExecutingCommand.java 33.33% 2 Missing ⚠️
...hardware/platform/windows/WindowsSoundCardFFM.java 0.00% 2 Missing ⚠️
...ava/oshi/util/platform/unix/solaris/KstatUtil.java 0.00% 2 Missing ⚠️
.../oshi/software/common/os/linux/LinuxOSProcess.java 0.00% 1 Missing ⚠️
...software/common/os/unix/AbstractProcOSProcess.java 0.00% 1 Missing ⚠️
...mmon/src/main/java/oshi/spi/SystemInfoFactory.java 0.00% 1 Missing ⚠️
...common/src/main/java/oshi/util/PrivilegedUtil.java 0.00% 1 Missing ⚠️
... and 16 more
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3611      +/-   ##
============================================
+ Coverage     79.81%   79.84%   +0.03%     
- Complexity     4108     4231     +123     
============================================
  Files           696      696              
  Lines         24220    24220              
  Branches       4057     4057              
============================================
+ Hits          19330    19339       +9     
+ Misses         2728     2719       -9     
  Partials       2162     2162              
Flag Coverage Δ
freebsd 33.52% <6.66%> (-0.01%) ⬇️
linux 37.64% <11.11%> (+0.01%) ⬆️
macos 38.48% <6.66%> (-0.01%) ⬇️
openbsd 32.70% <6.66%> (-0.01%) ⬇️
solaris 34.19% <6.66%> (-0.01%) ⬇️
windows 45.31% <11.11%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbwiddis
dbwiddis merged commit 2d853f4 into oshi:master Aug 14, 2026
19 checks passed
@dbwiddis
dbwiddis deleted the slf4j-log-throwable branch August 14, 2026 17:25
dbwiddis added a commit that referenced this pull request Aug 14, 2026
…a helpers (#3612)

* Log the throwable, not its message, in ExceptionUtil and the FFM arena helpers

PR #3611 drained the 74-site Slf4jDoNotLogMessageOfExceptionExplicitly backlog
and escalated that check to ERROR, but Error Prone cannot see through an argument
array: ExceptionUtil.logAtLevel built an Object[] holding both t.getMessage() and
t before dispatching, so the same defect it now forbids at every LOG call site
was still being applied on behalf of 200 callers, invisibly.

Drop the getMessage() element, so only the throwable is appended and the logging
backend renders it with its stack trace and cause chain. Correspondingly stop
ForeignFunctions.logThrowable synthesizing a ": {}" suffix on its caller's
message, and drop the now-redundant trailing placeholder from the 71 messages
that carried one. The remaining 129 call sites already omitted it -- their
getMessage() was an extra argument SLF4J silently discarded.

Two call sites were losing a real argument to that substitution, and now report
it: HkeyUserDataFFM.getSubKeys never logged the registry key path (its second
placeholder had no argument and printed literally), and
HkeyPerformanceDataUtilFFM.readPerfDataBuffer never logged the object name, even
though both sibling log calls in the same lambda do.

Also fix ForeignFunctions.dlopenWithFlags, which copied the failure's message
into the UnsatisfiedLinkError it throws and dropped the throwable, so the trace
dead-ended; UnsatisfiedLinkError has no (String, Throwable) constructor, so
attach the cause with initCause. Three fully-qualified oshi.util.LogLevel.WARN
references in files already static-importing WARN are de-qualified in passing.

* Widen the argument copy to Object[] and align the msg javadoc

Arrays.copyOf preserves the source array's runtime component type. Passing a
typed array to logAtLevel's varargs parameter is legal Java, and in that case
the copy came back as e.g. a String[], so appending the throwable to it threw
ArrayStoreException from inside the catch block - replacing the failure being
reported with an unrelated one. Ask for an Object[] explicitly, and pin it with
a test that passes a String[] (the cast there is a compile-time no-op, so the
array really is a String[] at runtime).

Only the two generic getOrDefault overloads documented that placeholders
correspond to the explicit arguments with none reserved for the exception; the
primitive, optional, and runnable overloads all just said "the log message".
Give them the same wording, since they forward to the same contract.
dbwiddis added a commit that referenced this pull request Aug 14, 2026
* Adopt jSpecify and document API nullability (Phase 1)

Phase 1 of the jSpecify rollout proposed in #3593: mark the two packages
that define the public API, oshi.hardware and oshi.software.os, as
@NullMarked so that every type usage in a signature there is non-null
unless it is explicitly annotated @nullable.

The dependency is compile-time metadata only. It is declared optional in
oshi-common/pom.xml, requires static in the module descriptor, and an
optional OSGi Import-Package, so it does not reach a consumer's runtime
classpath and does not become a transitive compile dependency.

Very little of the API turns out to be nullable, because OSHI reports an
unreadable value as a sentinel rather than null. The genuine exceptions
are now annotated and documented: OperatingSystem.getProcess(int), the
optional filter/sort arguments of the three process-listing methods, the
three OSVersionInfo fields and getters, PowerSource.getManufactureDate(),
InternetProtocolStats.IPConnection.getState() (null for UDP), the
ProcessorIdentifier microarchitecture argument, ApplicationInfo's
additionalInfo map, the OSProcess/OSThread ...CpuLoadBetweenTicks
arguments, and equals(@nullable Object).

Marking the packages surfaced two bugs:

DisplayInfoImpl's synthetic constructor stored its nullable arguments
as-is, so getSerialNo(), getPreferredResolution(), getModel(), and
getProductSerialNumber() could return null even though DisplayInfo
documents them non-null, and toString() rendered the text "null". This is
reachable in production: EdidUtil.synthesizeDisplayInfo passes a null
resolution when a display reports no pixel dimensions, which is how the
Apple Silicon built-in panel is constructed. Absent values now normalize
to the empty string, matching the convention the rest of the API follows.
Setting an empty preferred resolution into the synthesized EDID behaves
identically to leaving it null, so EDID synthesis is unchanged.

OperatingSystem.getProcesses() documented that the returned list "may
contain null elements" and was "sorted as specified"; neither has been
true. It now documents the same INVALID-state caveat as its siblings.

oshi.util and oshi.ffm are deliberately left unmarked. oshi.util holds
the @publicapi PlatformEnum but many more classes besides, and is Phase
2; oshi.ffm waits on an unreleased NullAway fix for a crash, which also
defers marking the @publicapi oshi.ffm.SystemInfo entry point.

FAQ.md gains a section collecting all three annotation families OSHI
uses to document contracts - @publicapi for semver scope, the
oshi.annotation.concurrent annotations for thread safety, and now
jSpecify for nullability - since a caller reading one of them will want
to know the others exist.

* Make the marked packages self-consistent for nullable parameters

Two loose ends from review, both declaration-only: no runtime behavior
changes and no new tests, because the existing tests already exercise the
null inputs involved.

ProcessorIdentifier.derivedMicroarchitecture was declared non-null but
assigned straight from the @nullable constructor argument. Normalize the
absent case to the empty string at the boundary, as DisplayInfoImpl now
does: queryMicroarchitecture reaches the field through Util.isBlank, which
treats null and empty identically, so Constants.UNKNOWN remains the result
when no microarchitecture is available. The local variable in that method
is deliberately left alone; jSpecify does not apply to local variable
declarations, whose nullness an analyzer infers.

Overrides in oshi.hardware and oshi.software.os cannot narrow a parameter
from @nullable to non-null, so an unannotated override of one in those
packages contradicts the interface. Every such override is a test double:
two in OSThreadTest, two in OSProcessTest, and three in OperatingSystemTest
(getProcesses, getChildProcesses, getDescendantProcesses). AbstractOSThread
and the platform implementations are not affected, as they live in
subpackages that are not marked and therefore make no nullness claim.

That is the first jspecify import from test code, so config/import-control-test.xml
needs the same allowlist entry the main import-control file already got.

* Enforce the jSpecify annotations with NullAway

The Phase 1 annotations documented the API's nullability but nothing
checked them, so a violation was only ever caught by review — as one
was: the @nullable microarchitecture assigned to a non-null field.

Add NullAway 0.13.8 to the existing error-prone profile at ERROR
severity with OnlyNullMarked=true and JSpecifyMode=true. OnlyNullMarked
scopes the analysis to @NullMarked code rather than to a module list, so
the two marked API packages are checked and everything else is
untouched; marking a package in a later phase needs no build change.
0.12.x is incompatible with Error Prone 2.50.0.

Fix the 16 findings this surfaces. One is in main code:
queryMicroarchitecture spells out its null-and-empty check because
NullAway cannot see through Util.isBlank to learn the value is non-null
on the branch that follows. The other 15 are test stubs returning null
for non-null API methods; they throw UnsupportedOperationException
instead, except OperatingSystemTest.getProcess(int), whose null is
load-bearing for the getCurrentProcess() default-method test and is
annotated @nullable to match the interface. The suite passing proves the
14 throws are unreached.

Verified the gate fires by reintroducing each finding class in turn:
assigning null to a non-null field, returning null from a non-null
method, and dereferencing a @nullable value all fail the build, and the
restored tree passes. -DskipTests skips test execution but not test
compilation, so the CI job covers test sources too.

Also correct the AGENTS.md note that oshi.ffm was blocked on a NullAway
fix; it is not, on 0.13.8.

* Tighten the changelog entries for this release

State the changed behavior and stop there. Combine #3611 and #3612,
which were one change to logging behavior split across two PRs.

* Drop getSerialNo() from the changelog's null-fix list

The only production callers of the synthetic DisplayInfo path are
MacDisplayJNA and MacDisplayFFM, both via EdidUtil.synthesizeDisplayInfo,
which substitutes "00000000" for an absent serial. getSerialNo() never
returned null there, so it was not one of the getters fixed.
dbwiddis added a commit that referenced this pull request Aug 16, 2026
Everything sat under "Bug Fixes and Improvements", which put the release's
headline change in the wrong place and left one entry carrying three
different kinds of change at once.

New Features: the JSpecify adoption, rewritten to lead with what a consumer
gets rather than what the sweep did to the build, and ParseUtil's new
getStringValueOrEmpty, which was a clause in the middle of that paragraph.

Behavior Changes: the null-to-sentinel list, promoted out of its sub-bullet.
Someone whose code tests those getters for null now has dead branches, and
that was the least visible thing in the section. #3616 moves here from Bug
Fixes, being the same kind of change.

Removals: #3608's 14 WMI forwarding shims, Util.isBlankOrUnknown and
ParseUtil.slash, with a note that they sit outside the semver-guaranteed API
and are listed only because removing them can break a compile.

Bug Fixes and Improvements keeps #3589 and #3611/#3612, gains the hardening
work split out of the JSpecify entry, and gains #3639, which had no entry at
all: the Windows GPU utilization path tested its cached tick sample for null
and then dereferenced it in a second read, so a concurrent poll could throw.

Dependency bumps get no entries; none changed anything user-visible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant