Binder does not allow for a blank selection of enum

Bug #579945 reported by Dave Cheong
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
play framework
Status tracked in 1.0
1.0
Fix Released
Undecided
Unassigned
1.1
Fix Committed
Undecided
Unassigned

Bug Description

This bug relates to the discussion found here:
http://groups.google.com/group/play-framework/browse_thread/thread/5f27d6cefc79f967

It is a proposal to change Binder.bindInternal() to distinguish the difference between submitting a blank enum choice and not submitting a value at all.

The suggested fix is:

             if (Enum.class.isAssignableFrom(clazz)) {
                 if (value == null) {
                     return MISSING;
                 }
                 else if (value.length == 0 || StringUtils.isEmpty(value[0])) {
                     return null;
                 }
                 return Enum.valueOf(clazz, value[0]);
             }

The problem is found on 1.0.2.1. Guillaume suggest the fix for 1.0.3.

thanks,
dave

Tags: binder enum web
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.