log message after migration

Hi,

After migration my application from vaadin 6 to vaadin 7 I noticed the following warning message in the log file:

com.vaadin.data.util.LegacyPropertyHelper maybeLogLegacyPropertyToStringWarning
You are using toString() instead of getValue() to get the value for a Property of type com.vaadin.ui.ComboBox.
This is strongly discouraged and only provided for backwards compatibility with Vaadin 6.
To disable this warning message and retain the behavior, set the init parameter “legacyPropertyToString” to “true”.
To disable the legacy functionality, set “legacyPropertyToString” to false.
(Note that your debugger might call toString() and trigger this message).
To find out who is calling toString(), enable FINE level logging.

As far as I know I do not use toString on a ComboBox.

Should I consider this an ‘internal’ vaadin message or should I blame myself?

Regards,
Joost

Chances are it comes from one of your code. I never encountered a point where toString was used in Vaadin internal code.
You could also disable the legacypropertytostring as described
here
.

The problem is that Java can call toString() implicitly even without the string “toString()” appearing in your code. Vaadin should never have allowed getting the value using toString() as detecting such implicit use of it later is really hard, but it was used by Vaadin anyway as the result of a bad design decision some ten years ago.

You could e.g. put a breakpoint in your ComboBox toString() method to see where it is called from - just be careful because the debugger might then call toString() when showing the currently active variables including “this”.

Thanks Henri,

it was indeed an implicit toString() call: not on the comboBox itself, but on the event parameter in the ValueChangeListener :

Actually event.getProperty() (used in a debug statement) caused the warning.

Please note that the example in the vaadin 7 book (chapter 5.15.8) also contains the same construct …

Regards,
Joost

Thank you for pointing this out. I
created a ticket
to correct this in the book.