Bug 53421 - BeanELResolver's inner class BeanProperty throws incorrect message while PropertyNotFound
Summary: BeanELResolver's inner class BeanProperty throws incorrect message while Prop...
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: trunk
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-15 13:54 UTC by Ian YT Tsai
Modified: 2012-06-23 13:19 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.