On Tue, 7 Mar 2023 11:59:20 GMT, Florian Kirmaier <[email protected]> wrote:
> When an exception is logged in JavaFX, then the exception is kept in a
> reference.
> This way, always the last logged exception is retained.
>
> This is a memory-leak.
> This was done to write unit-tests to ensure certain error-cases are logged.
>
> A simple fix is, to add a flag, to enable/disable retaining the exception.
The fix looks OK, with a couple requested changes.
As discussed earlier, let's also file a follow-up bug to rework this so that
the exception is never kept in the first place, but rather just the (fully
qualified) name of the exception class.
modules/javafx.base/src/main/java/com/sun/javafx/binding/Logging.java line 32:
> 30: public class Logging {
> 31:
> 32: public static boolean keepException = false;
I'd rather see a private field and a public setter/getter here. Please also add
a comment on the setter/getter indicating that they are only used for testing.
modules/javafx.base/src/test/java/test/com/sun/javafx/binding/TestLogging.java
line 1:
> 1: package test.com.sun.javafx.binding;
You need to add a standard copyright header.
-------------
PR: https://git.openjdk.org/jfx/pull/1053