You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Patrice DUROUX (Jira)" <ji...@apache.org> on 2020/01/13 16:51:00 UTC

[jira] [Comment Edited] (WW-5043) trouble with Enum subclassing

    [ https://issues.apache.org/jira/browse/WW-5043?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17014468#comment-17014468 ] 

Patrice DUROUX edited comment on WW-5043 at 1/13/20 4:50 PM:
-------------------------------------------------------------

Hi James.

Thanks for your consideration.

I can confirm you that using Struts 2.5.22 (based on OGNL 3.1.26) did not solved my issue.

If it may help here is there runtime exception trace:

{{{{17:37:34.072 [http-nio-8080-exec-2] WARN com.opensymphony.xwork2.ognl.OgnlValueStack - Caught an exception while evaluating expression '@test.struts.Strange@A==@test.struts.Strange@B' against value stack}}}}
{{ {{java.lang.IllegalArgumentException: invalid comparison: test.struts.Strange$1 and test.struts.Strange$2}}}}
{{ {{ at ognl.OgnlOps.compareWithConversion(OgnlOps.java:93) ~[ognl-3.1.26.jar:?]}}}}
{{ {{ at ognl.OgnlOps.isEqual(OgnlOps.java:149) ~[ognl-3.1.26.jar:?]}}}}
{{ {{ at ognl.OgnlOps.equal(OgnlOps.java:808) ~[ognl-3.1.26.jar:?]}}}}
{{ {{ at ognl.ASTEq.getValueBody(ASTEq.java:52) ~[ognl-3.1.26.jar:?]}}}}
{{ {{ at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:206) ~[ognl-3.1.26.jar:?]}}}}
{{ {{ at ognl.SimpleNode.getValue(SimpleNode.java:258) ~[ognl-3.1.26.jar:?]}}}}
{{ {{ at ognl.Ognl.getValue(Ognl.java:537) ~[ognl-3.1.26.jar:?]}}}}


was (Author: pduroux):
Hi James.

Thanks for your consideration.

I can confirm you that using Struts 2.5.22 (based on OGNL 3.1.26) did not solved my issue.

If it may help here is there runtime exception trace:

{{17:37:34.072 [http-nio-8080-exec-2] WARN com.opensymphony.xwork2.ognl.OgnlValueStack - Caught an exception while evaluating expression '@test.struts.Strange@A==@test.struts.Strange@B' against value stack}}
{{java.lang.IllegalArgumentException: invalid comparison: test.struts.Strange$1 and test.struts.Strange$2}}
{{ at ognl.OgnlOps.compareWithConversion(OgnlOps.java:93) ~[ognl-3.1.26.jar:?]}}
{{ at ognl.OgnlOps.isEqual(OgnlOps.java:149) ~[ognl-3.1.26.jar:?]}}
{{ at ognl.OgnlOps.equal(OgnlOps.java:808) ~[ognl-3.1.26.jar:?]}}
{{ at ognl.ASTEq.getValueBody(ASTEq.java:52) ~[ognl-3.1.26.jar:?]}}
{{ at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:206) ~[ognl-3.1.26.jar:?]}}
{{ at ognl.SimpleNode.getValue(SimpleNode.java:258) ~[ognl-3.1.26.jar:?]}}
{{ at ognl.Ognl.getValue(Ognl.java:537) ~[ognl-3.1.26.jar:?]}}

> trouble with Enum subclassing
> -----------------------------
>
>                 Key: WW-5043
>                 URL: https://issues.apache.org/jira/browse/WW-5043
>             Project: Struts 2
>          Issue Type: Bug
>            Reporter: Patrice DUROUX
>            Priority: Major
>
> Hi,
> I found the following problem using Struts (2.5.20) based on OGNL (3.1.21) and same result forcing OGNL (3.1.25, as 3.2.x series seem to be not compatible with this version of Struts).
> The situation can be summarize  with the following 2 enums:
> {code:java}
> enum Normal { A, B; }
> enum Strange {A {}, B{}; } // mainly for implementing abstract method(s)
> {code}
> and the following expressions are:
> {noformat}
> @Normal@A==@Normal@A // true
> @Normal@A!=@Normal@A // false
> @Normal@A==@Normal@B // false
> @Normal@A!=@Normal@B // true{noformat}
> whereas the following expressions are:
> {noformat}
> @Strange@A==@Strange@A // true
> @Strange@A!=@Strange@A // false
> @Strange@A==@Strange@B // false (with warn log)
> @Strange@A!=@Strange@B // false (with warn log){noformat}
> and the origin of the wrong test value was discover activating WARN log level in Struts (using struts.devMode).
> Thanks,
> Patrice



--
This message was sent by Atlassian Jira
(v8.3.4#803005)