Better error reporting when ScrptConverter._serialize() fails to serialize an object

Description

It would be great if the ScrptConverter._serialize() would output the serialization stack with the error to help identify why an object is not serializing. I was running into issues today trying to track down why an object would not serialize and I ended up having to download the source code and do an interactive debugging session to track what was happening.

Even just modifying the throw new ConverterException("can't serialize Object of type [ " + Caster.toClassName(object) + " ]"); line with something like this would be tremendously helpful:

throw new ConverterException("can't serialize Object of type [ " + Caster.toClassName(object) + " ]\n\nSerialization results:\n" + sb.toString());

This would print out the results of the serialization string, which should point where in the CF code the problem occurred. A better solution would be to end up generating an error which contained the class name and the specific path to the object, for example something that looked like:

cannott serialize ‘customer.variables.addresss.this.logger.sessioni.requestContext.variables.Coldbox.variables.foo’ as [ org.apache.tomcat.util.log.SystemLogHandler ] object is not serializable

Activity

Show:

Pothys - MitrahSoft 7 February 2024 at 17:11

I've checked this issue with Lucee latest version 6.0.1.64-SNAPSHOT. The error message now correctly displays the class name and the specific path to the object. So I'm closing the ticket.

Michael Offner 7 February 2024 at 14:58

dan.switzer@givainc.com 7 February 2024 at 14:57

Thanks!

Zac Spitzer 26 May 2023 at 13:08

https://github.com/lucee/Lucee/pull/2085

can't serialize Object of type [ lucee.runtime.ComponentImpl ], exception thrown was [can't serialize Object of type [ lucee.runtime.type.StructImpl ], exception thrown was [can't serialize Object of type [ java.io.PrintStream ]]]

Fixed

Details

Assignee

Reporter

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Fix versions

Affects versions

Priority

Created 18 May 2022 at 21:47
Updated 23 January 2025 at 16:25
Resolved 7 February 2024 at 17:11

Flag notifications