Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DC39B200AE2 for ; Fri, 27 May 2016 11:14:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id DAC9E160A3C; Fri, 27 May 2016 09:14:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2A1D5160A37 for ; Fri, 27 May 2016 11:14:14 +0200 (CEST) Received: (qmail 35650 invoked by uid 500); 27 May 2016 09:14:13 -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 35227 invoked by uid 99); 27 May 2016 09:14:13 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 May 2016 09:14:13 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 05B842C1F68 for ; Fri, 27 May 2016 09:14:13 +0000 (UTC) Date: Fri, 27 May 2016 09:14:13 +0000 (UTC) From: =?utf-8?Q?Pawe=C5=82_K=C5=82apsa_=28JIRA=29?= To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (JEXL-191) Jexl3 unsolvable property exception when using enum MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 27 May 2016 09:14:15 -0000 [ https://issues.apache.org/jira/browse/JEXL-191?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D153037= 90#comment-15303790 ]=20 Pawe=C5=82 K=C5=82apsa commented on JEXL-191: ----------------------------------- Does anyone know when version 3.1 will be published? > 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.0.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 =3D new JexlEngine(); > Record r =3D new Record(); > r.setHeader(new RecordHeader()); > JexlContext jc =3D new MapContext(); > jc.set("r", r ); > jc.set("com.sytrue.objects.Gender", Gender.class ); > Expression e =3D jexl.createExpression( "r.header.gender=3Dcom.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 =3D new JexlBuilder().create(); > Record r =3D new Record(); > r.setHeader(new RecordHeader()); > JexlContext jc =3D new MapContext(); > jc.set("r", r ); > jc.set("com.sytrue.objects.Gender", Gender.class ); > JexlExpression e =3D jexl.createExpression( "r.header.gender=3Dcom.sy= true.objects.Gender.FEMALE" ); > System.out.println( e.evaluate(jc) ); > } > {code} > The exception is: > {code} > Exception in thread "main" org.apache.commons.jexl3.JexlException$Propert= y: com.sytrue.objects.record.app.JexlTestApp.main@1:42 unsolvable property = 'FEMALE' > {code} > Temporary workaround is using the valueOf method: > {code:java} > JexlExpression e =3D jexl.createExpression( "r.header.gender=3Dcom.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)