Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 91DD818709 for ; Fri, 18 Mar 2016 08:51:34 +0000 (UTC) Received: (qmail 47610 invoked by uid 500); 18 Mar 2016 08:51:34 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 47483 invoked by uid 500); 18 Mar 2016 08:51:34 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 47452 invoked by uid 99); 18 Mar 2016 08:51:34 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Mar 2016 08:51:34 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id F3CAD2C1F61 for ; Fri, 18 Mar 2016 08:51:33 +0000 (UTC) Date: Fri, 18 Mar 2016 08:51:33 +0000 (UTC) From: "Henri Biestro (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (JEXL-191) Jexl3 unsolvable property exception when using enum MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/JEXL-191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Henri Biestro resolved JEXL-191. -------------------------------- Resolution: Fixed Fix Version/s: 3.1 src/main/java/org/apache/commons/jexl3/internal/introspection/Uberspect.java src/test/java/org/apache/commons/jexl3/PublicFieldsTest.java src/site/xdoc/changes.xml Committed revision 1735550. > Jexl3 unsolvable property exception when using enum > --------------------------------------------------- > > Key: JEXL-191 > URL: https://issues.apache.org/jira/browse/JEXL-191 > Project: Commons JEXL > Issue Type: Bug > Affects Versions: 3.0 > Reporter: Constantin Mitocaru > Assignee: Henri Biestro > Priority: Critical > Fix For: 3.1 > > > This code used to work under jexl2 > {code:java} > public enum Gender { MALE, FEMALE}; > public static void main( String[] args ) throws ClassNotFoundException { > JexlEngine jexl = new JexlEngine(); > Record r = new Record(); > r.setHeader(new RecordHeader()); > JexlContext jc = new MapContext(); > jc.set("r", r ); > jc.set("com.sytrue.objects.Gender", Gender.class ); > Expression e = jexl.createExpression( "r.header.gender=com.sytrue.objects.Gender.FEMALE" ); > System.out.println( e.evaluate(jc) ); > } > {code} > but under jexl3 it throws an exception: > {code:java} > public static void main( String[] args ) throws ClassNotFoundException { > JexlEngine jexl = new JexlBuilder().create(); > Record r = new Record(); > r.setHeader(new RecordHeader()); > JexlContext jc = new MapContext(); > jc.set("r", r ); > jc.set("com.sytrue.objects.Gender", Gender.class ); > JexlExpression e = jexl.createExpression( "r.header.gender=com.sytrue.objects.Gender.FEMALE" ); > System.out.println( e.evaluate(jc) ); > } > {code} > The exception is: > {code} > Exception in thread "main" org.apache.commons.jexl3.JexlException$Property: com.sytrue.objects.record.app.JexlTestApp.main@1:42 unsolvable property 'FEMALE' > {code} > Temporary workaround is using the valueOf method: > {code:java} > JexlExpression e = jexl.createExpression( "r.header.gender=com.sytrue.objects.Gender.valueOf('FEMALE')" ); > {code} > It seems that I no longer can access the enum type in jexl3. > Is there any reason this doesn't work anymore or it is a bug -- This message was sent by Atlassian JIRA (v6.3.4#6332)