Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8097814

Bindings class spits out a lot of unneeded log messages

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8u20
    • Fix Version/s: 8u20
    • Component/s: javafx
    • Labels:
    • Environment:

      Windows 8.1 64 bit, Java 8 b128

    • Subcomponent:

      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. :)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              msladecek Martin Sládeček
              Reporter:
              cbanackjfx Cory Banack (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: