openhab / openhab-js

openHAB JavaScript Library for JavaScript Scripting Automation
https://www.openhab.org/addons/automation/jsscripting/
Eclipse Public License 2.0
38 stars 31 forks source link

[utils] dumpObject‘s getAllPropertyNames(obj) doesn‘t log properties #104

Closed florian-h05 closed 2 years ago

florian-h05 commented 2 years ago

Expected Behavior

utils.dumpObject(object) should log all properties of a object with the getAllPropertyNames(obj) method.

Current Behavior

When I use utils.dumpObject(object), I get the following log output:

2022-04-01 15:42:41.457 [INFO ] [org.openhab.automation.script.utils ] - Dumping object...
2022-04-01 15:42:41.458 [INFO ] [org.openhab.automation.script.utils ] -   typeof obj = object
2022-04-01 15:42:41.460 [INFO ] [org.openhab.automation.script.utils ] -   Java.isJavaObject(obj) = false
2022-04-01 15:42:41.462 [INFO ] [org.openhab.automation.script.utils ] -   Java.isType(obj) = false
2022-04-01 15:42:41.471 [INFO ] [org.openhab.automation.script.utils ] - getAllPropertyNames(obj) = [object Array]

As you can see, getAllPropertyNames(obj) in the last line returns an Array, whose members should be logged.

Possible Solution

I will open a PR with a fix very soon. This issue is only for bug tracking.