[ https://issues.apache.org/jira/browse/MYFACES-2633?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Leonardo Uribe resolved MYFACES-2633. ------------------------------------- Resolution: Fixed Fix Version/s: 2.0.0-beta-4 > Cannot set properties on custom composite component class when are > implemented on getter/setter > ----------------------------------------------------------------------------------------------- > > Key: MYFACES-2633 > URL: https://issues.apache.org/jira/browse/MYFACES-2633 > Project: MyFaces Core > Issue Type: Bug > Components: JSR-314 > Affects Versions: 2.0.0-beta-3 > Reporter: Leonardo Uribe > Assignee: Leonardo Uribe > Fix For: 2.0.0-beta-4 > > > Implementing a custom composite component class with some properties in the > old way (getter/setter), so there is no attribute map on the middle, I found > a bug when I try to set them. The stack trace is this: > javax.faces.FacesException: java.lang.IllegalArgumentException: argument type > mismatch > at > org.apache.myfaces.context.ExceptionHandlerImpl.wrap(ExceptionHandlerImpl.java:241) > at > org.apache.myfaces.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:156) > at > org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:222) > at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191) > at > org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502) > at > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389) > at > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) > at > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) > at > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) > at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417) > at > org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) > at > org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) > at > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) > at org.mortbay.jetty.Server.handle(Server.java:324) > at > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:535) > at > org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:865) > at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539) > at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) > at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) > at > org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) > at > org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520) > Caused by: java.lang.IllegalArgumentException: argument type mismatch > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at > javax.faces.component._ComponentAttributesMap.setComponentProperty(_ComponentAttributesMap.java:450) > at > javax.faces.component._ComponentAttributesMap.put(_ComponentAttributesMap.java:345) > at > javax.faces.component._ComponentAttributesMap.put(_ComponentAttributesMap.java:58) > at > org.apache.myfaces.view.facelets.tag.composite.CompositeComponentRule$ValueExpressionMetadata.applyMetadata(CompositeComponentRule.java:83) > at > org.apache.myfaces.view.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:45) > at > org.apache.myfaces.view.facelets.tag.composite.CompositeComponentResourceTagHandler.setAttributes(CompositeComponentResourceTagHandler.java:269) > at > org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate.apply(ComponentTagHandlerDelegate.java:200) > at > javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:54) > at > javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:51) > at > javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:59) > at > org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate.apply(ComponentTagHandlerDelegate.java:255) > at > javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:54) > at > javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:51) > at > javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:59) > at > org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate.apply(ComponentTagHandlerDelegate.java:255) > at > javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:54) > at > javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:51) > at > org.apache.myfaces.view.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:57) > at > javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:51) > at > org.apache.myfaces.view.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:45) > at > org.apache.myfaces.view.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:114) > at > org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.buildView(FaceletViewDeclarationLanguage.java:298) > at > org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:88) > at > org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:207) > The line that cause the problem is this (class CompositeComponentRule): > public void applyMetadata(FaceletContext ctx, Object instance) > { > // Call setValueExpression to set ValueExpression instances > // cause problems later because when getAttributes().get() is > called > // it is evaluated. put the ValueExpression directly on the map > // prevents it and does not cause any side effects. > // Maybe we should call setValueExpression when the getter and > // setter exists on the component class. > ((UIComponent) instance).getAttributes().put(_name, > _attr.getValueExpression(ctx, _type)); > //((UIComponent) instance).setValueExpression(_name, > _attr.getValueExpression(ctx, _type)); > //((UIComponent) instance).setValueExpression(_name, > // ctx.getFacesContext().getApplication(). > // getExpressionFactory().createValueExpression( > // _attr.getValueExpression(ctx, _type), > ValueExpression.class)); > } > This code comes from MYFACES-2340. The used one in normal components is this: > ((UIComponent) instance).setValueExpression(_name, > _attr.getValueExpression(ctx, _type)); > The curious thing about it is that if we restore the code to the old way > everything works fine. This code was changed trying to solve MYFACES-2340, > but this example also works with the previous fix. > I did some tests and no problems were detected. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.