groovy

RuntimeException in SwingBuilder data binding

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.6.3
  • Fix Version/s: 1.6.4, 1.7-beta-1
  • Component/s: Swing
  • Labels:
    None
  • Environment:
    Windows XP, Java 6
  • Number of attachments :
    2

Description

I have a small class that tests SwingBuilder.bind(). One textfield in the
GUI is bound to a model property of type Date so that a conversion is
needed from String to Date. The binding specifies a converter.

Unfortunately, when the GUI fires up, an exception is thrown saying this:

Exception in thread "main" java.lang.RuntimeException: Failed to create
component for 'bind' reason:
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast
object '01.01.1970' with class 'java.lang.String' to class
'java.util.Date'

This message shows me that the converter has not been invoked.

Attached, I send the sample code and the stacktrace. In the
code, there is a section that works fine (commented out) and a section
that throws the exception (non-commented, active code). It seems as if the
full binding syntax does not work as good as the simplified syntax.
However, I need the full syntax because I really want to bind to a
FocusLost event, not to a property.

Activity

Hide
Matthias Bohlen added a comment -

The stack trace of the exception thrown.

Show
Matthias Bohlen added a comment - The stack trace of the exception thrown.
Hide
Danno Ferrin added a comment -

The binding was firing it's update method before attributes were being applied (like the converter attribute). so I moved the update to the node complete phase.

Show
Danno Ferrin added a comment - The binding was firing it's update method before attributes were being applied (like the converter attribute). so I moved the update to the node complete phase.
Hide
Matthias Bohlen added a comment -

Thanks, Danno, for fixing this! Keep up the good work!

Show
Matthias Bohlen added a comment - Thanks, Danno, for fixing this! Keep up the good work!
Hide
Danno Ferrin added a comment -

The patch would have been quicker, but it got lost in a machine move. Cult initiations can be so taxing

Show
Danno Ferrin added a comment - The patch would have been quicker, but it got lost in a machine move. Cult initiations can be so taxing

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: