Eric Norman created SLING-10682:
-----------------------------------
Summary: Comparison operators doesn't work to compare enum to
another enum
Key: SLING-10682
URL: https://issues.apache.org/jira/browse/SLING-10682
Project: Sling
Issue Type: Bug
Reporter: Eric Norman
Assignee: Eric Norman
Fix For: Scripting HTL Compiler 1.2.14-1.4.0
An expression that attempts to compare an enum to another enum throws a
SightlyCompilerException exception with a message stating that the operands are
not of same type.
{{Caused by:
org.apache.sling.scripting.sightly.compiler.SightlyCompilerException: Operands
are not of the same type: the equality operator can only be applied to String,
Number and Boolean types.
at
org.apache.sling.scripting.sightly.compiler.expression.nodes.BinaryOperator.strictEq(BinaryOperator.java:247)
[org.apache.sling.scripting.sightly.compiler:1.2.12.140]
at
org.apache.sling.scripting.sightly.libs.sling.servlet.__0064__efault.acl_body__002e__html.render(acl_body__002e__html.java:57)
at
org.apache.sling.scripting.sightly.render.RenderUnit.render(RenderUnit.java:53)
[org.apache.sling.scripting.sightly.runtime:1.2.5.140-SNAPSHOT]
at
org.apache.sling.scripting.sightly.impl.engine.SightlyCompiledScript.eval(SightlyCompiledScript.java:61)
[org.apache.sling.scripting.sightly:1.4.9.140-SNAPSHOT]
at
org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:386)
[org.apache.sling.scripting.core:2.3.6]
at
org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:184)
[org.apache.sling.scripting.core:2.3.6]
at
org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:491)
[org.apache.sling.scripting.core:2.3.6]
... 92 common frames omitted}}
Expected:
Comparing two enum objects should work without throwing any exception.
For example:
enum equals enum = ${myEnum.ONE == myEnum.ONE}
enum notEquals enum = ${myEnum.ONE != myEnum.TWO}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)