From 02ddd2d4affecf9abc2f94cdd4387faecd1deda4 Mon Sep 17 00:00:00 2001 From: "David M. Lloyd" Date: Wed, 20 Dec 2023 10:25:28 -0600 Subject: [PATCH] [LOGMGR-344] Fix signature of `invokeExact` sigpoly call --- .../java/org/jboss/logmanager/ExtLogRecord.java | 2 +- .../org/jboss/logmanager/ExtLogRecordTests.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/test/java/org/jboss/logmanager/ExtLogRecordTests.java diff --git a/src/main/java/org/jboss/logmanager/ExtLogRecord.java b/src/main/java/org/jboss/logmanager/ExtLogRecord.java index 310a1e0c..cd0448c6 100644 --- a/src/main/java/org/jboss/logmanager/ExtLogRecord.java +++ b/src/main/java/org/jboss/logmanager/ExtLogRecord.java @@ -689,7 +689,7 @@ public long getLongThreadID() { void superSetLongThreadID(final long id) { if (superSetLongThreadID != null) { try { - superSetLongThreadID.invokeExact(this, id); + LogRecord ignored = (LogRecord) superSetLongThreadID.invokeExact(this, id); } catch (RuntimeException | Error e) { throw e; } catch (Throwable e) { diff --git a/src/test/java/org/jboss/logmanager/ExtLogRecordTests.java b/src/test/java/org/jboss/logmanager/ExtLogRecordTests.java new file mode 100644 index 00000000..a48de789 --- /dev/null +++ b/src/test/java/org/jboss/logmanager/ExtLogRecordTests.java @@ -0,0 +1,16 @@ +package org.jboss.logmanager; + +import org.junit.jupiter.api.Test; + +/** + * + */ +public final class ExtLogRecordTests { + + @Test + public void checkForLongThreadIdRegression() { + ExtLogRecord rec = new ExtLogRecord(Level.INFO, "Hello world!", ExtLogRecordTests.class.getName()); + // expect this to not blow up on 11 or 17 + rec.setLongThreadID(1234); + } +}