Question about a change in the el-api in v7.0.14
All, This is my first post for the Tomcat project, and I do hope it is the right place for this question, as it is involving a change in the development branch. I have implemented my own EL based on the EL API. The EL API interface provided in Tomcat I used up to v7.0.12 made all my test pass, and then when I switched to v7.0.14, I have two errors returned when accessing an Integer instance from a Map of properties. Please see below the patch I have extracted between v7.0.12 and v7.0.14 explaining the issue I have seen and I would like to understand the reason of returning an Object.class and not the class type of the value stored ? Thanks in advance for your help, and if this is not the right place I should ask this question, just tell me and I will send it to the user mailing list. diff -uNrbB javax/el/ListELResolver.java ../../apache-tomcat-7.0.14-src/java/javax/el/ListELResolver.java --- javax/el/ListELResolver.java2011-04-01 17:16:46 + +++ ../../apache-tomcat-7.0.14-src/java/javax/el/ListELResolver.java 2011-05-09 21:44:02 + @@ -74,8 +74,7 @@ throw new PropertyNotFoundException( new ArrayIndexOutOfBoundsException(idx).getMessage()); } -Object obj = list.get(idx); -return (obj != null) ? obj.getClass() : null; +return Object.class; } return null; diff -uNrbB javax/el/MapELResolver.java ../../apache-tomcat-7.0.14-src/java/javax/el/MapELResolver.java --- javax/el/MapELResolver.java2011-04-01 17:16:46 + +++ ../../apache-tomcat-7.0.14-src/java/javax/el/MapELResolver.java 2011-05-09 21:44:02 + @@ -64,8 +64,7 @@ if (base instanceof Map?,?) { context.setPropertyResolved(true); -Object obj = ((Map?,?) base).get(property); -return (obj != null) ? obj.getClass() : null; +return Object.class; } return null; Best regards, -- Emmanuel Poitier- Chief Executive Officer (CEO) Enman Telephone:+33 (0)2 54 67 15 38 Mobile:+33 (0)64 9461 586 Email:emmanuel.poit...@enman.fr Web site:http://enman.fr attachment: emmanuel_poitier.vcf smime.p7s Description: Signature cryptographique S/MIME
Re: Question about a change in the el-api in v7.0.14
On 07/01/2013 10:03, Emmanuel Poitier wrote: All, This is my first post for the Tomcat project, and I do hope it is the right place for this question, as it is involving a change in the development branch. This is one of a the few questions that could be asked on either list. As a general rule, if you are unsure you should use the users mailing list. I have implemented my own EL based on the EL API. The EL API interface provided in Tomcat I used up to v7.0.12 made all my test pass, and then when I switched to v7.0.14, I have two errors returned when accessing an Integer instance from a Map of properties. Please see below the patch I have extracted between v7.0.12 and v7.0.14 explaining the issue I have seen and I would like to understand the reason of returning an Object.class and not the class type of the value stored ? Thanks in advance for your help, and if this is not the right place I should ask this question, just tell me and I will send it to the user mailing list. If you want to understand the reason for a change, then the first place you should look is the change history for the files in question. The ASF provides a web based interface to this at [1]. The organisation of Tomcat's part of the tree is described in [2]. The history you need to read is [3] which will lead you to [4] and the Expression Language 2.2 specification sections 2.14.7 and 2.15.7 all of which will explain why the change was made. Mark [1] http://svn.apache.org/viewvc/ [2] http://tomcat.apache.org/svn.html [3] http://svn.apache.org/viewvc/tomcat/trunk/java/javax/el/ListELResolver.java?view=log [4] https://issues.apache.org/bugzilla/show_bug.cgi?id=51177 diff -uNrbB javax/el/ListELResolver.java ../../apache-tomcat-7.0.14-src/java/javax/el/ListELResolver.java --- javax/el/ListELResolver.java2011-04-01 17:16:46 + +++ ../../apache-tomcat-7.0.14-src/java/javax/el/ListELResolver.java 2011-05-09 21:44:02 + @@ -74,8 +74,7 @@ throw new PropertyNotFoundException( new ArrayIndexOutOfBoundsException(idx).getMessage()); } -Object obj = list.get(idx); -return (obj != null) ? obj.getClass() : null; +return Object.class; } return null; diff -uNrbB javax/el/MapELResolver.java ../../apache-tomcat-7.0.14-src/java/javax/el/MapELResolver.java --- javax/el/MapELResolver.java2011-04-01 17:16:46 + +++ ../../apache-tomcat-7.0.14-src/java/javax/el/MapELResolver.java 2011-05-09 21:44:02 + @@ -64,8 +64,7 @@ if (base instanceof Map?,?) { context.setPropertyResolved(true); -Object obj = ((Map?,?) base).get(property); -return (obj != null) ? obj.getClass() : null; +return Object.class; } return null; Best regards, -- Emmanuel Poitier- Chief Executive Officer (CEO) Enman Telephone:+33 (0)2 54 67 15 38 Mobile:+33 (0)64 9461 586 Email:emmanuel.poit...@enman.fr Web site:http://enman.fr - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Question about a change in the el-api in v7.0.14
Mark, thanks for the prompt answer, and yes I do know now why the change was made. Le 07/01/2013 11:20, Mark Thomas a écrit : On 07/01/2013 10:03, Emmanuel Poitier wrote: All, This is my first post for the Tomcat project, and I do hope it is the right place for this question, as it is involving a change in the development branch. This is one of a the few questions that could be asked on either list. As a general rule, if you are unsure you should use the users mailing list. I have implemented my own EL based on the EL API. The EL API interface provided in Tomcat I used up to v7.0.12 made all my test pass, and then when I switched to v7.0.14, I have two errors returned when accessing an Integer instance from a Map of properties. Please see below the patch I have extracted between v7.0.12 and v7.0.14 explaining the issue I have seen and I would like to understand the reason of returning an Object.class and not the class type of the value stored ? Thanks in advance for your help, and if this is not the right place I should ask this question, just tell me and I will send it to the user mailing list. If you want to understand the reason for a change, then the first place you should look is the change history for the files in question. The ASF provides a web based interface to this at [1]. The organisation of Tomcat's part of the tree is described in [2]. The history you need to read is [3] which will lead you to [4] and the Expression Language 2.2 specification sections 2.14.7 and 2.15.7 all of which will explain why the change was made. Mark [1] http://svn.apache.org/viewvc/ [2] http://tomcat.apache.org/svn.html [3] http://svn.apache.org/viewvc/tomcat/trunk/java/javax/el/ListELResolver.java?view=log [4] https://issues.apache.org/bugzilla/show_bug.cgi?id=51177 diff -uNrbB javax/el/ListELResolver.java ../../apache-tomcat-7.0.14-src/java/javax/el/ListELResolver.java --- javax/el/ListELResolver.java2011-04-01 17:16:46 + +++ ../../apache-tomcat-7.0.14-src/java/javax/el/ListELResolver.java 2011-05-09 21:44:02 + @@ -74,8 +74,7 @@ throw new PropertyNotFoundException( new ArrayIndexOutOfBoundsException(idx).getMessage()); } -Object obj = list.get(idx); -return (obj != null) ? obj.getClass() : null; +return Object.class; } return null; diff -uNrbB javax/el/MapELResolver.java ../../apache-tomcat-7.0.14-src/java/javax/el/MapELResolver.java --- javax/el/MapELResolver.java2011-04-01 17:16:46 + +++ ../../apache-tomcat-7.0.14-src/java/javax/el/MapELResolver.java 2011-05-09 21:44:02 + @@ -64,8 +64,7 @@ if (base instanceof Map?,?) { context.setPropertyResolved(true); -Object obj = ((Map?,?) base).get(property); -return (obj != null) ? obj.getClass() : null; +return Object.class; } return null; Best regards, -- Emmanuel Poitier- Chief Executive Officer (CEO) Enman Telephone:+33 (0)2 54 67 15 38 Mobile:+33 (0)64 9461 586 Email:emmanuel.poit...@enman.fr Web site:http://enman.fr - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org Best regards, -- Emmanuel Poitier- Chief Executive Officer (CEO) Enman Telephone:+33 (0)2 54 67 15 38 Mobile:+33 (0)64 9461 586 Email:emmanuel.poit...@enman.fr Web site:http://enman.fr attachment: emmanuel_poitier.vcf smime.p7s Description: Signature cryptographique S/MIME