Return-Path: Delivered-To: apmail-myfaces-dev-archive@www.apache.org Received: (qmail 4475 invoked from network); 28 May 2010 18:52:58 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 28 May 2010 18:52:58 -0000 Received: (qmail 3113 invoked by uid 500); 28 May 2010 18:52:58 -0000 Delivered-To: apmail-myfaces-dev-archive@myfaces.apache.org Received: (qmail 3071 invoked by uid 500); 28 May 2010 18:52:58 -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 3064 invoked by uid 99); 28 May 2010 18:52:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 May 2010 18:52:58 +0000 X-ASF-Spam-Status: No, hits=-1598.8 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 May 2010 18:52:57 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o4SIqblj012403 for ; Fri, 28 May 2010 18:52:37 GMT Message-ID: <4711656.56231275072757097.JavaMail.jira@thor> Date: Fri, 28 May 2010 14:52:37 -0400 (EDT) From: "Jakob Korherr (JIRA)" To: dev@myfaces.apache.org Subject: [jira] Created: (MYFACES-2739) Pass through String values in EnumConverter.getAsString() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Pass through String values in EnumConverter.getAsString() --------------------------------------------------------- Key: MYFACES-2739 URL: https://issues.apache.org/jira/browse/MYFACES-2739 Project: MyFaces Core Issue Type: Improvement Components: JSR-314 Affects Versions: 2.0.0 Reporter: Jakob Korherr Assignee: Jakob Korherr >From the related spec issue (#817 - https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=817): In every standard by-type converter in the JSF spec, except for the EnumConverter, the following code is present in getAsString(): if (value instanceof String) { return (String) value; } Thus allowing String values to be used directly as the String representation of the type. This allows e.g. the following scenario for an Integer property in the managed bean to work, although "1234" beeing a String and not an Integer: However the spec javadoc of the EnumConverter does not include this scenario and thus EnumConverter.getAsString() throws a ConverterException when providing a String value. This means that the following scenario won't work, although it should on my opinion (note that this currently does work with Mojarra because of an implementation issue - see [1] for details): EnumConstant1 beeing a valid constant in the enum type referenced by #{myBean.inputEnum}. The only way to make this work right now is to use a ValueExpression that resolves to the needed enum constant, so something like this: This is not very straight forward IMHO, thus I think EnumConverter.getAsString() should pass through String-values just as every other standard by-type converter does. See also the discussion on the MyFaces user mailing list about this [2]. [1] https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1694 [2] http://www.mail-archive.com/users@myfaces.apache.org/msg55742.html -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.