Bug 53421

Summary: BeanELResolver's inner class BeanProperty throws incorrect message while PropertyNotFound
Product: Tomcat 7 Reporter: Ian YT Tsai <zanyking>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Ian YT Tsai 2012-06-15 13:54:17 UTC
BeanELResolver's inner class BeanProperty(line: 264) has two methods (write, read) that will throw PropertyNotFoundException. And there current implementation are wrong:

  throw new PropertyNotFoundException(message(ctx,
                            "propertyNotWritable", new Object[] {
                                    type.getName(), descriptor.getName() }));

it should use owner.getName() instead of type.getName() because the assembled message will be:

Property '[descriptor.getName()]' not readable on type [type.getName()]

Here the descriptor.getName() means the property name, type.getName() means the property type's name and the owner.getName() means the property owner - bean's type name.

Of course we developer would prefer to receive a message that tells us which bean type doesn't contain such property because this is a PropertyNotFoundException.
Comment 1 Ian YT Tsai 2012-06-15 13:55:34 UTC
Sorry, the FQCN of BeanELResolver is javax.el.BeanELResolver
Comment 2 Mark Thomas 2012-06-23 13:19:27 UTC
Thanks for the report. Fixed in trunk and 7.0.x and will be included in 7.0.29 onwards.