You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Niall Pemberton (JIRA)" <ji...@apache.org> on 2009/01/13 21:39:05 UTC

[jira] Issue Comment Edited: (BEANUTILS-334) at org.apache.commons.beanutils.expression.DefaultResolver.getIndex(DefaultResolver.java:94)

    [ https://issues.apache.org/jira/browse/BEANUTILS-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663461#action_12663461 ] 

niallp edited comment on BEANUTILS-334 at 1/13/09 12:37 PM:
---------------------------------------------------------------------

One of the problems with BeanUtils prior to version 1.8.0 is that the parsing of property names (nested/indexed/mapped) was duplicated in several places and was inconsistent.

>From your stack trace it appears that you are trying to set an indexed property, but without specifying an index value (e.g. foo[] ) in the BeanUtils/BeanUtilsBean's setProperty method this scenario was silently swallowed - whereas in PropertyUtils/PropertyUtilsBean's setProperty it would throw an IllegalArgumentException.

It was because of this type of inconsistency that the parsing of property names was extracted out into a Resolver[1][2] (see BEANUTILS-259) so that from version 1.8.0 it would be consistent accross BeanUtils.

Can you confirm the property name that your application is faling on (you can turn on logging in debug mode to see what BeanUtils is doing) and also whether you think this is an error in your application uncovered by the stricter parsing in the new Resolver or whether you think there is a valid use case for this scenario.

If there is a valid use case then perhaps one solution would be to provide strict/lenient modes for the default Resolver to operate in. In the meantime you can plug in your own customer Resolver[3] implementation to work round this scenario - something like:

    BeanUtilsBean.getInstance().getPropertyUtils().setResolver(...);

[1] http://svn.apache.org/repos/asf/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/expression/
[2] http://commons.apache.org/beanutils/v1.8.0/apidocs/org/apache/commons/beanutils/expression/package-summary.html
[3] http://tinyurl.com/848ped

      was (Author: niallp):
    One of the problems with BeanUtils prior to version 1.8.0 is that the parsing of property names (nested/indexed/mapped) was duplicated in several places and was inconsistent.

>From your stack trace it appears that you are trying to set an indexed property, but without specifying an index value (e.g. foo[] ) in the BeanUtils/BeanUtilsBean's setProperty method this scenario was silently swallowed - whereas in PropertyUtils/PropertyUtilsBean's setProperty it would throw an IllegalArgumentException.

It was because of this type of inconsistency that the parsing of property names was extracted out into a Resolver[1][2] (see BEANUTILS-259) so that from version 1.8.0 it would be consistent accross BeanUtils.

Can you confirm the property name that your application is faling on (you can turn on logging in debug mode to see what BeanUtils is doing) and also whether you think this is an error in your application uncovered by the stricter parsing in the new Resolver or whether you think there is a valid use case for this scenario.

If there is a valid use case then perhaps one solution would be to provide strict/lenient modes for the default Resolver to operate in. In the meantime you can plug in your own customer Resolver[3] implementation to work round this scenario - something like:

    BeanUtilsBean.getInstance().getPropertyUtils().setResolver(...);

[1] http://svn.apache.org/repos/asf/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/expression/
[2] http://commons.apache.org/beanutils/v1.8.0/apidocs/org/apache/commons/beanutils/expression/package-summary.html
[3] http://commons.apache.org/beanutils/v1.8.0/apidocs/org/apache/commons/beanutils/PropertyUtilsBean.html#setResolver(org.apache.commons.beanutils.expression.Resolver)
  
> at org.apache.commons.beanutils.expression.DefaultResolver.getIndex(DefaultResolver.java:94)
> --------------------------------------------------------------------------------------------
>
>                 Key: BEANUTILS-334
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-334
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: Bean / Property Utils, Bean-Collections
>    Affects Versions: 1.8.0-BETA
>         Environment: Windows XP Professional, JDK.15, Websphere 6.1, RAD 7.0, Struts 1.1
>            Reporter: Madhu Palutla
>         Attachments: error.txt, screenshot-1.jpg, screenshot-2.jpg
>
>
> The application working fine with commons-beanutils-1.3.jar. Recently we upgraded the application to support java 1.5 and one of the microsoft api jar is looking for commons-beanutils-1.8.0.jar so we also upgraded the commons-beanutils-1.3.jar to commons-beanutils-1.8.0.jar. Now aplication is giving following errors in Struts 1.1 application.
> Log:
> 1/12/09 16:04:07:878 EST] 00000031 ServletWrappe E   SRVE0068E: Uncaught exception thrown in one of the service methods of the servlet: action. Exception thrown : javax.servlet.ServletException: BeanUtils.populate
> 	at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
> 	at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
> 	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
> 	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
> 	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> 	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
> 	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
> 	at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
> 	at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3129)
> 	at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)
> 	at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
> 	at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)
> 	at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93)
> 	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
> 	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
> 	at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
> 	at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
> 	at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
> 	at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
> 	at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
> 	at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)
> 	at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)
> 	at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)
> 	at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)
> ---- Begin backtrace for Nested Throwables
> java.lang.IllegalArgumentException: No Index Value
> 	at org.apache.commons.beanutils.expression.DefaultResolver.getIndex(DefaultResolver.java:94)
> 	at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:917)
> 	at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:830)
> 	at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:433)
> 	at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
> 	at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
> 	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
> 	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
> 	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> 	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
> 	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
> 	at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
> 	at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3129)
> 	at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)
> 	at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
> 	at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)
> 	at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93)
> 	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
> 	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
> 	at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
> 	at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
> 	at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
> 	at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
> 	at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
> 	at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)
> 	at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)
> 	at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)
> 	at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.