Return-Path: X-Original-To: apmail-myfaces-dev-archive@www.apache.org Delivered-To: apmail-myfaces-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 17DE0609C for ; Wed, 27 Jul 2011 18:12:35 +0000 (UTC) Received: (qmail 51972 invoked by uid 500); 27 Jul 2011 18:12:34 -0000 Delivered-To: apmail-myfaces-dev-archive@myfaces.apache.org Received: (qmail 51938 invoked by uid 500); 27 Jul 2011 18:12:34 -0000 Mailing-List: contact dev-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Development" Delivered-To: mailing list dev@myfaces.apache.org Received: (qmail 51931 invoked by uid 99); 27 Jul 2011 18:12:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Jul 2011 18:12:33 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Jul 2011 18:12:31 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 949D78D7F5 for ; Wed, 27 Jul 2011 18:12:09 +0000 (UTC) Date: Wed, 27 Jul 2011 18:12:09 +0000 (UTC) From: "Matt Benson (JIRA)" To: dev@myfaces.apache.org Message-ID: <781017453.12774.1311790329605.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Issue Comment Edited] (MYFACES-2552) TagValueExpression.getType() returns null if the property in the managed bean is null and the expression points to a facelets composite component attribute MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/MYFACES-2552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13071894#comment-13071894 ] Matt Benson edited comment on MYFACES-2552 at 7/27/11 6:12 PM: --------------------------------------------------------------- For future reference, this issue can be worked around in any JSF 2+ environment by simply adding a custom ELResolver with this method: @Override public Class getType(ELContext context, Object base, Object property) { if (base instanceof CompositeComponentExpressionHolder && property instanceof String) { ValueExpression expr = ((CompositeComponentExpressionHolder) base).getExpression((String) property); if (expr != null) { return expr.getType(context); } } return null; } Remaining methods should return null/false i.e. do nothing. was (Author: mbenson): For future reference, this issue can be worked around in any JSF 2+ environment by simply adding a custom ELResolver with this method: @Override public Class getType(ELContext context, Object base, Object property) { if (base instanceof CompositeComponentExpressionHolder && property instanceof String) { ValueExpression expr = ((CompositeComponentExpressionHolder) base).getExpression((String) property); if (expr != null) { return expr.getType(context); } } return null; } Remaining methods should return {{null}}/{{false}} i.e. do nothing. > TagValueExpression.getType() returns null if the property in the managed bean is null and the expression points to a facelets composite component attribute > ----------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: MYFACES-2552 > URL: https://issues.apache.org/jira/browse/MYFACES-2552 > Project: MyFaces Core > Issue Type: Bug > Components: JSR-314 > Affects Versions: 2.1.0 > Reporter: Jakob Korherr > Assignee: Jakob Korherr > Attachments: MYFACES-2552-spec-proposal.patch > > > if you have a facelets composite component with an attribute "test" that points to a property in a managed bean (e.g. #{myBean.property}) which is currently null and you refer to that attribute in the implementation via #{cc.attrs.test} you can get the current value (null) or set a new value but you cannot get the type of the property (e.g. String[]). However if the property in the managed bean is non-null you can get the type. > For example: > > > > > > > > > --> calling #{cc.attrs.test}.getType() will fail if #{cc.attrs.test} resolves to null, but will work if #{cc.attrs.test} resolves to some valid value. > This currently results in a NullPointerException in _SharedRendererUtils.getConvertedUISelectManyValue(). -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira