Null Pointer Exception when calling server.os.toString()

Description

In CommandBox, run `repl server.os.toString()`. On my machine, server.os.macAddress is null (separate issue, I know), and `toString()` fails to properly serialize the null value.

Here is a partial stacktrace:

{{Java Stacktrace lucee.runtime.exp.NativeException: java.lang.NullPointerException
at lucee.commons.io.MacAddressWrap.toString(SystemUtil.java:1620)
at lucee.commons.io.MacAddressWrap.castToString(SystemUtil.java:1614)
at lucee.runtime.op.Caster.toString(Caster.java:1858)
at testbox.system.reports.junitreporter_cfc$cf.udfCall(/testbox/system/reports/JUnitReporter.cfc:168)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:226)
at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:803)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:756)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1718)
at testbox.system.reports.junitreporter_cfc$cf.udfCall(/testbox/system/reports/JUnitReporter.cfc:152)}}

For now, the workaround seems to be using serializeJSON( ) instead of .toString().

This seems related to Issue #1245, except that I do Not have full null support enabled.

Environment

CommandBox 4.5, Lucee 5.2.9.31

Assignee

Unassigned

Reporter

Michael Born

Priority

Critical

Labels

None

Fix versions

Sprint

None

Affects versions

Configure