Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
> griffon --version
------------------------------------------------------------
Griffon 1.1.0
------------------------------------------------------------
Build: 20-Sep-2012 07:25 PM
Groovy: 1.8.8
Ant: 1.8.4
Slf4j: 1.7.1
Spring: 3.1.2.RELEASE
JVM: 1.7.0_09 (Oracle Corporation 23.5-b02)
OS: Windows 7 6.1 amd64
> griffon --version ------------------------------------------------------------ Griffon 1.1.0 ------------------------------------------------------------ Build: 20-Sep-2012 07:25 PM Groovy: 1.8.8 Ant: 1.8.4 Slf4j: 1.7.1 Spring: 3.1.2.RELEASE JVM: 1.7.0_09 (Oracle Corporation 23.5-b02) OS: Windows 7 6.1 amd64
Description
If a Griffon user accidentally replaces curly braces {} with parentheses () in a call to bind, the error either fails silently at runtime or with a cryptic compiler error (depending on the widget type).
In the sample code (attached), the first textfield and button work correctly. The 2nd textfield (error #1) fails silently (it is blank, no compiler warnings). If uncommented, the 2nd button (error #2) causes a cryptic runtime exception (java.lang.NullPointerException - see full stacktrace attached).
Sample Griffon code for project "bug":
-- BugView.groovy ---------------------------------------------- package bug def makeText = { phrase -> textField( columns:10, text: bind { phrase.insect } ) // correct button( "Larvae", enabled: bind { phrase.enabled } ) // correct textField( columns:10, text: bind ( phrase.insect ) ) // error #1 - silent failure // button( "Larvae", enabled: bind ( phrase.enabled ) ) // error #2 - compiler error } def val = 1 application( title: 'bug', preferredSize: [320, 240], pack: true, location: [50,50], iconImage: imageIcon('/griffon-icon-48x48.png').image ) { borderLayout() panel( constraints: CENTER, border: titledBorder(title: 'Bug Test')) { widget( makeText( model."data${val}" ) ) } } -- BugModel.groovy ---------------------------------------------- package bug import groovy.beans.Bindable @Bindable class BugModel { Map data1 = [ insect:"Buggy Text", buggyFlag: true ] as ObservableMap }