You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "William Bakker (Created) (JIRA)" <ji...@apache.org> on 2012/03/09 11:52:58 UTC
[jira] [Created] (JEXL-130) Ternary Conditional fails for Object
values
Ternary Conditional fails for Object values
-------------------------------------------
Key: JEXL-130
URL: https://issues.apache.org/jira/browse/JEXL-130
Project: Commons JEXL
Issue Type: Bug
Affects Versions: 2.1
Reporter: William Bakker
The documentation states on http://commons.apache.org/jexl/reference/syntax.html#Operators :
{quote}
The usual ternary conditional operator condition ? if_true : if_false operator can be used as well as the
abbreviation value ?: if_false which returns the value if its evaluation is defined, non-null and non-false
{quote}
For object values however, it seems that this definition no longer holds in 2.1 and higher.
The following unittests run successfully in 2.0.1, but the test "ternaryConditional_mapContainsObject_shouldReturnObject" fails in 2.1 and 2.1.1.
{code}
import org.apache.commons.jexl2.*;
import org.junit.*;
public class JexlTernaryConditionalTest
{
@Test
public void ternaryConditional_mapContainsString_shouldReturnString()
{
String myName = "Test.Name";
Object myValue = "Test.Value";
JexlEngine myJexlEngine = new JexlEngine();
MapContext myMapContext = new MapContext();
myMapContext.set(myName, myValue);
Object myObjectWithTernaryConditional = myJexlEngine.createScript(myName + "?:null").execute(myMapContext);
Assert.assertEquals(myValue, myObjectWithTernaryConditional);
}
@Test
public void ternaryConditional_mapContainsObject_shouldReturnObject()
{
String myName = "Test.Name";
Object myValue = new Object();
JexlEngine myJexlEngine = new JexlEngine();
MapContext myMapContext = new MapContext();
myMapContext.set(myName, myValue);
Object myObjectWithTernaryConditional = myJexlEngine.createScript(myName + "?:null").execute(myMapContext);
Assert.assertEquals(myValue, myObjectWithTernaryConditional);
}
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (JEXL-130) Ternary Conditional fails for Object
values
Posted by "Henri Biestro (Resolved) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JEXL-130?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Biestro resolved JEXL-130.
--------------------------------
Resolution: Fixed
Fix Version/s: 2.1.2
https://svn.apache.org/repos/asf/commons/proper/jexl/branches/2.0/src/main/java/org/apache/commons/jexl2/JexlArithmetic.javaCommitted revision 1298857.
(NOT trunk BUT 2.0 branch!)
> Ternary Conditional fails for Object values
> -------------------------------------------
>
> Key: JEXL-130
> URL: https://issues.apache.org/jira/browse/JEXL-130
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 2.1, 2.1.1
> Reporter: William Bakker
> Assignee: Henri Biestro
> Fix For: 2.1.2
>
>
> The documentation states on http://commons.apache.org/jexl/reference/syntax.html#Operators :
> {quote}
> The usual ternary conditional operator condition ? if_true : if_false operator can be used as well as the
> abbreviation value ?: if_false which returns the value if its evaluation is defined, non-null and non-false
> {quote}
> For object values however, it seems that this definition no longer holds in 2.1 and higher.
> The following unittests run successfully in 2.0.1, but the test "ternaryConditional_mapContainsObject_shouldReturnObject" fails in 2.1 and 2.1.1.
> {code}
> import org.apache.commons.jexl2.*;
> import org.junit.*;
> public class JexlTernaryConditionalTest
> {
> @Test
> public void ternaryConditional_mapContainsString_shouldReturnString()
> {
> String myName = "Test.Name";
> Object myValue = "Test.Value";
> JexlEngine myJexlEngine = new JexlEngine();
> MapContext myMapContext = new MapContext();
> myMapContext.set(myName, myValue);
> Object myObjectWithTernaryConditional = myJexlEngine.createScript(myName + "?:null").execute(myMapContext);
> Assert.assertEquals(myValue, myObjectWithTernaryConditional);
> }
> @Test
> public void ternaryConditional_mapContainsObject_shouldReturnObject()
> {
> String myName = "Test.Name";
> Object myValue = new Object();
> JexlEngine myJexlEngine = new JexlEngine();
> MapContext myMapContext = new MapContext();
> myMapContext.set(myName, myValue);
> Object myObjectWithTernaryConditional = myJexlEngine.createScript(myName + "?:null").execute(myMapContext);
> Assert.assertEquals(myValue, myObjectWithTernaryConditional);
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (JEXL-130) Ternary Conditional fails for Object
values
Posted by "Henri Biestro (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JEXL-130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13226126#comment-13226126 ]
Henri Biestro commented on JEXL-130:
------------------------------------
Thanks William! Very clear bug case btw.
> Ternary Conditional fails for Object values
> -------------------------------------------
>
> Key: JEXL-130
> URL: https://issues.apache.org/jira/browse/JEXL-130
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 2.1, 2.1.1
> Reporter: William Bakker
> Assignee: Henri Biestro
> Fix For: 2.1.2
>
>
> The documentation states on http://commons.apache.org/jexl/reference/syntax.html#Operators :
> {quote}
> The usual ternary conditional operator condition ? if_true : if_false operator can be used as well as the
> abbreviation value ?: if_false which returns the value if its evaluation is defined, non-null and non-false
> {quote}
> For object values however, it seems that this definition no longer holds in 2.1 and higher.
> The following unittests run successfully in 2.0.1, but the test "ternaryConditional_mapContainsObject_shouldReturnObject" fails in 2.1 and 2.1.1.
> {code}
> import org.apache.commons.jexl2.*;
> import org.junit.*;
> public class JexlTernaryConditionalTest
> {
> @Test
> public void ternaryConditional_mapContainsString_shouldReturnString()
> {
> String myName = "Test.Name";
> Object myValue = "Test.Value";
> JexlEngine myJexlEngine = new JexlEngine();
> MapContext myMapContext = new MapContext();
> myMapContext.set(myName, myValue);
> Object myObjectWithTernaryConditional = myJexlEngine.createScript(myName + "?:null").execute(myMapContext);
> Assert.assertEquals(myValue, myObjectWithTernaryConditional);
> }
> @Test
> public void ternaryConditional_mapContainsObject_shouldReturnObject()
> {
> String myName = "Test.Name";
> Object myValue = new Object();
> JexlEngine myJexlEngine = new JexlEngine();
> MapContext myMapContext = new MapContext();
> myMapContext.set(myName, myValue);
> Object myObjectWithTernaryConditional = myJexlEngine.createScript(myName + "?:null").execute(myMapContext);
> Assert.assertEquals(myValue, myObjectWithTernaryConditional);
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (JEXL-130) Ternary Conditional fails for Object
values
Posted by "Henri Biestro (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JEXL-130?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Biestro updated JEXL-130:
-------------------------------
Affects Version/s: 2.1.1
Confirmed as bug; fix to come in JexlArithmetic.toBoolean() // non null values that can not be interpreted as boolean should return true
> Ternary Conditional fails for Object values
> -------------------------------------------
>
> Key: JEXL-130
> URL: https://issues.apache.org/jira/browse/JEXL-130
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 2.1, 2.1.1
> Reporter: William Bakker
> Assignee: Henri Biestro
>
> The documentation states on http://commons.apache.org/jexl/reference/syntax.html#Operators :
> {quote}
> The usual ternary conditional operator condition ? if_true : if_false operator can be used as well as the
> abbreviation value ?: if_false which returns the value if its evaluation is defined, non-null and non-false
> {quote}
> For object values however, it seems that this definition no longer holds in 2.1 and higher.
> The following unittests run successfully in 2.0.1, but the test "ternaryConditional_mapContainsObject_shouldReturnObject" fails in 2.1 and 2.1.1.
> {code}
> import org.apache.commons.jexl2.*;
> import org.junit.*;
> public class JexlTernaryConditionalTest
> {
> @Test
> public void ternaryConditional_mapContainsString_shouldReturnString()
> {
> String myName = "Test.Name";
> Object myValue = "Test.Value";
> JexlEngine myJexlEngine = new JexlEngine();
> MapContext myMapContext = new MapContext();
> myMapContext.set(myName, myValue);
> Object myObjectWithTernaryConditional = myJexlEngine.createScript(myName + "?:null").execute(myMapContext);
> Assert.assertEquals(myValue, myObjectWithTernaryConditional);
> }
> @Test
> public void ternaryConditional_mapContainsObject_shouldReturnObject()
> {
> String myName = "Test.Name";
> Object myValue = new Object();
> JexlEngine myJexlEngine = new JexlEngine();
> MapContext myMapContext = new MapContext();
> myMapContext.set(myName, myValue);
> Object myObjectWithTernaryConditional = myJexlEngine.createScript(myName + "?:null").execute(myMapContext);
> Assert.assertEquals(myValue, myObjectWithTernaryConditional);
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (JEXL-130) Ternary Conditional fails for Object
values
Posted by "Henri Biestro (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JEXL-130?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Biestro updated JEXL-130:
-------------------------------
Comment: was deleted
(was: Confirmed as bug; fix to come in JexlArithmetic.toBoolean() // non null values that can not be interpreted as boolean should return true)
> Ternary Conditional fails for Object values
> -------------------------------------------
>
> Key: JEXL-130
> URL: https://issues.apache.org/jira/browse/JEXL-130
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 2.1, 2.1.1
> Reporter: William Bakker
> Assignee: Henri Biestro
>
> The documentation states on http://commons.apache.org/jexl/reference/syntax.html#Operators :
> {quote}
> The usual ternary conditional operator condition ? if_true : if_false operator can be used as well as the
> abbreviation value ?: if_false which returns the value if its evaluation is defined, non-null and non-false
> {quote}
> For object values however, it seems that this definition no longer holds in 2.1 and higher.
> The following unittests run successfully in 2.0.1, but the test "ternaryConditional_mapContainsObject_shouldReturnObject" fails in 2.1 and 2.1.1.
> {code}
> import org.apache.commons.jexl2.*;
> import org.junit.*;
> public class JexlTernaryConditionalTest
> {
> @Test
> public void ternaryConditional_mapContainsString_shouldReturnString()
> {
> String myName = "Test.Name";
> Object myValue = "Test.Value";
> JexlEngine myJexlEngine = new JexlEngine();
> MapContext myMapContext = new MapContext();
> myMapContext.set(myName, myValue);
> Object myObjectWithTernaryConditional = myJexlEngine.createScript(myName + "?:null").execute(myMapContext);
> Assert.assertEquals(myValue, myObjectWithTernaryConditional);
> }
> @Test
> public void ternaryConditional_mapContainsObject_shouldReturnObject()
> {
> String myName = "Test.Name";
> Object myValue = new Object();
> JexlEngine myJexlEngine = new JexlEngine();
> MapContext myMapContext = new MapContext();
> myMapContext.set(myName, myValue);
> Object myObjectWithTernaryConditional = myJexlEngine.createScript(myName + "?:null").execute(myMapContext);
> Assert.assertEquals(myValue, myObjectWithTernaryConditional);
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Issue Comment Edited] (JEXL-130) Ternary Conditional fails
for Object values
Posted by "Henri Biestro (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JEXL-130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13226118#comment-13226118 ]
Henri Biestro edited comment on JEXL-130 at 3/9/12 2:53 PM:
------------------------------------------------------------
https://svn.apache.org/repos/asf/commons/proper/jexl/branches/2.0/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java
Committed revision 1298857.
(NOT trunk BUT 2.0 branch!)
was (Author: henrib):
https://svn.apache.org/repos/asf/commons/proper/jexl/branches/2.0/src/main/java/org/apache/commons/jexl2/JexlArithmetic.javaCommitted revision 1298857.
(NOT trunk BUT 2.0 branch!)
> Ternary Conditional fails for Object values
> -------------------------------------------
>
> Key: JEXL-130
> URL: https://issues.apache.org/jira/browse/JEXL-130
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 2.1, 2.1.1
> Reporter: William Bakker
> Assignee: Henri Biestro
> Fix For: 2.1.2
>
>
> The documentation states on http://commons.apache.org/jexl/reference/syntax.html#Operators :
> {quote}
> The usual ternary conditional operator condition ? if_true : if_false operator can be used as well as the
> abbreviation value ?: if_false which returns the value if its evaluation is defined, non-null and non-false
> {quote}
> For object values however, it seems that this definition no longer holds in 2.1 and higher.
> The following unittests run successfully in 2.0.1, but the test "ternaryConditional_mapContainsObject_shouldReturnObject" fails in 2.1 and 2.1.1.
> {code}
> import org.apache.commons.jexl2.*;
> import org.junit.*;
> public class JexlTernaryConditionalTest
> {
> @Test
> public void ternaryConditional_mapContainsString_shouldReturnString()
> {
> String myName = "Test.Name";
> Object myValue = "Test.Value";
> JexlEngine myJexlEngine = new JexlEngine();
> MapContext myMapContext = new MapContext();
> myMapContext.set(myName, myValue);
> Object myObjectWithTernaryConditional = myJexlEngine.createScript(myName + "?:null").execute(myMapContext);
> Assert.assertEquals(myValue, myObjectWithTernaryConditional);
> }
> @Test
> public void ternaryConditional_mapContainsObject_shouldReturnObject()
> {
> String myName = "Test.Name";
> Object myValue = new Object();
> JexlEngine myJexlEngine = new JexlEngine();
> MapContext myMapContext = new MapContext();
> myMapContext.set(myName, myValue);
> Object myObjectWithTernaryConditional = myJexlEngine.createScript(myName + "?:null").execute(myMapContext);
> Assert.assertEquals(myValue, myObjectWithTernaryConditional);
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (JEXL-130) Ternary Conditional fails for Object
values
Posted by "Henri Biestro (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JEXL-130?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Biestro updated JEXL-130:
-------------------------------
Confirmed as bug; fix to come in JexlArithmetic.toBoolean() // non null values that can not be interpreted as boolean should return true
> Ternary Conditional fails for Object values
> -------------------------------------------
>
> Key: JEXL-130
> URL: https://issues.apache.org/jira/browse/JEXL-130
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 2.1, 2.1.1
> Reporter: William Bakker
> Assignee: Henri Biestro
>
> The documentation states on http://commons.apache.org/jexl/reference/syntax.html#Operators :
> {quote}
> The usual ternary conditional operator condition ? if_true : if_false operator can be used as well as the
> abbreviation value ?: if_false which returns the value if its evaluation is defined, non-null and non-false
> {quote}
> For object values however, it seems that this definition no longer holds in 2.1 and higher.
> The following unittests run successfully in 2.0.1, but the test "ternaryConditional_mapContainsObject_shouldReturnObject" fails in 2.1 and 2.1.1.
> {code}
> import org.apache.commons.jexl2.*;
> import org.junit.*;
> public class JexlTernaryConditionalTest
> {
> @Test
> public void ternaryConditional_mapContainsString_shouldReturnString()
> {
> String myName = "Test.Name";
> Object myValue = "Test.Value";
> JexlEngine myJexlEngine = new JexlEngine();
> MapContext myMapContext = new MapContext();
> myMapContext.set(myName, myValue);
> Object myObjectWithTernaryConditional = myJexlEngine.createScript(myName + "?:null").execute(myMapContext);
> Assert.assertEquals(myValue, myObjectWithTernaryConditional);
> }
> @Test
> public void ternaryConditional_mapContainsObject_shouldReturnObject()
> {
> String myName = "Test.Name";
> Object myValue = new Object();
> JexlEngine myJexlEngine = new JexlEngine();
> MapContext myMapContext = new MapContext();
> myMapContext.set(myName, myValue);
> Object myObjectWithTernaryConditional = myJexlEngine.createScript(myName + "?:null").execute(myMapContext);
> Assert.assertEquals(myValue, myObjectWithTernaryConditional);
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira