Details
Description
The javafx.beans.binding.Bindings class has a lot of spots where it spits out a stack trace to the console even when no error or problem has occurred. This issue was partially described in:
https://javafx-jira.kenai.com/browse/RT-35526
But that bug was closed as a WONTFIX, even though the last comment from Martin Sladecek said it would be fixed eventually. (??)
The problem goes deeper than the Bindings.select methods described in that bug. I stumbled upon it with Bindings.valueAt(List, index), too. The comment for that method says that the Binding will evaluate to null if I pass in an index that is larger than the List. Which it does. But it also spits out a large stack trace to the console every time this happens, via this bit of code:
protected E computeValue() {
try {
return op.get(index);
} catch (IndexOutOfBoundsException ex) {
Logging.getLogger().warning("Exception while evaluating binding", ex);
}
return null;
}
A little investigation shows that this kind of thing (i.e. logging details when everything is operating as it should) is happening in many other places in that class, too.
I submit that it is NOT a good idea to Log details to the console in non-error situations like this. (in fact, I would argue that library code like JavaFX should NEVER directly log things to my console, but that is a different discussion.) The more immediate problem for me is that my console is filling up with all sorts of spurious stack traces even though nothing is actually broken!
My suggestion to fix the problem? Go through all the calls to Logging.getLogger() in Bindings, and delete them. Or at least review them to make sure they really belong there. Which they don't. :)
https://javafx-jira.kenai.com/browse/RT-35526
But that bug was closed as a WONTFIX, even though the last comment from Martin Sladecek said it would be fixed eventually. (??)
The problem goes deeper than the Bindings.select methods described in that bug. I stumbled upon it with Bindings.valueAt(List, index), too. The comment for that method says that the Binding will evaluate to null if I pass in an index that is larger than the List. Which it does. But it also spits out a large stack trace to the console every time this happens, via this bit of code:
protected E computeValue() {
try {
return op.get(index);
} catch (IndexOutOfBoundsException ex) {
Logging.getLogger().warning("Exception while evaluating binding", ex);
}
return null;
}
A little investigation shows that this kind of thing (i.e. logging details when everything is operating as it should) is happening in many other places in that class, too.
I submit that it is NOT a good idea to Log details to the console in non-error situations like this. (in fact, I would argue that library code like JavaFX should NEVER directly log things to my console, but that is a different discussion.) The more immediate problem for me is that my console is filling up with all sorts of spurious stack traces even though nothing is actually broken!
My suggestion to fix the problem? Go through all the calls to Logging.getLogger() in Bindings, and delete them. Or at least review them to make sure they really belong there. Which they don't. :)
Attachments
Issue Links
- duplicates
-
JDK-8094059 BooleanProperty: longish info message bubbles up in application code
- Resolved
-
JDK-8096384 [javaFX8] Bindings created with Bindings.selectXXX() cause NPE upon evaluation
- Resolved