Skip to content

Commit f943d87

Browse files
committed
Fix native object detection in the logging module
1 parent 648205f commit f943d87

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Fix native object detection in the logging module
13+
1014
## [2.3.0] - 2025-10-21
1115

1216
### Changed

logger/src/main/java/org/jboss/elemento/logger/Logger.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,12 @@ private boolean jsNative(Object object) {
501501
if (object == null || !Js.typeof(object).equals("object")) {
502502
return true;
503503
}
504-
return objectType(object).startsWith("[object ");
504+
try {
505+
String objectType = objectType(object);
506+
return objectType != null && objectType.startsWith("[object ");
507+
} catch (Throwable t) {
508+
return false;
509+
}
505510
}
506511

507512
@JsMethod(namespace = JsPackage.GLOBAL, name = "Object.prototype.toString.call")

0 commit comments

Comments
 (0)