[
https://issues.apache.org/jira/browse/OGNL-40?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13153302#comment-13153302
]
Simone Tripodi commented on OGNL-40:
------------------------------------
Hi again Daniel,
I just applied your patch and I have some tests failures:
{code}
Failed tests:
runTest[2](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
--1f uncompiled vs compiled expected: java.lang.Double<1.0> but was:
java.lang.Float<1.0>
runTest[6](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5f-2F uncompiled vs compiled expected: java.lang.Double<3.0> but was:
java.lang.Float<3.0>
runTest[9](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
-1b uncompiled vs compiled expected: java.lang.Integer<-1> but was:
java.math.BigDecimal<-1>
runTest[10](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
+1b uncompiled vs compiled expected: java.lang.Integer<1> but was:
java.math.BigDecimal<1>
runTest[11](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
--1b uncompiled vs compiled expected: java.lang.Integer<1> but was:
java.math.BigDecimal<1>
runTest[12](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
2*2.0b uncompiled vs compiled expected: java.lang.Double<4.0> but was:
java.math.BigDecimal<4.0>
runTest[13](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5/2.B uncompiled vs compiled expected: java.lang.Integer<2> but was:
java.math.BigDecimal<2>
runTest[14](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5.0B/2 uncompiled vs compiled expected: java.lang.Double<2.5> but was:
java.math.BigDecimal<2.5>
runTest[15](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5+2b uncompiled vs compiled expected: java.lang.Integer<7> but was:
java.math.BigDecimal<7>
runTest[16](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5-2B uncompiled vs compiled expected: java.lang.Integer<3> but was:
java.math.BigDecimal<3>
runTest[17](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5.+2b*3 uncompiled vs compiled expected: java.lang.Double<11.0> but was:
java.math.BigDecimal<11.0>
runTest[18](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
(5.+2b)*3 uncompiled vs compiled expected: java.lang.Double<21.0> but was:
java.math.BigDecimal<21.0>
runTest[35](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5. & 3 uncompiled vs compiled expected:<1> but was:<1.0>
runTest[38](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5&(3|5^3) uncompiled vs compiled expected: java.lang.Long<5> but was:
java.lang.Integer<5>
runTest[40](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
-1h uncompiled vs compiled expected: java.lang.Integer<-1> but was:
java.math.BigInteger<-1>
runTest[41](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
+1H uncompiled vs compiled expected: java.lang.Integer<1> but was:
java.math.BigInteger<1>
runTest[42](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
--1h uncompiled vs compiled expected: java.lang.Integer<1> but was:
java.math.BigInteger<1>
runTest[43](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
2h*2 uncompiled vs compiled expected: java.lang.Integer<4> but was:
java.math.BigInteger<4>
runTest[44](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5/2h uncompiled vs compiled expected: java.lang.Integer<2> but was:
java.math.BigInteger<2>
runTest[45](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5h+2 uncompiled vs compiled expected: java.lang.Integer<7> but was:
java.math.BigInteger<7>
runTest[46](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5-2h uncompiled vs compiled expected: java.lang.Integer<3> but was:
java.math.BigInteger<3>
runTest[47](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5+2H*3 uncompiled vs compiled expected: java.lang.Integer<11> but was:
java.math.BigInteger<11>
runTest[48](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
(5+2H)*3 uncompiled vs compiled expected: java.lang.Integer<21> but was:
java.math.BigInteger<21>
runTest[49](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
~1h uncompiled vs compiled expected: java.lang.Integer<-2> but was:
java.math.BigInteger<-2>
runTest[50](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5h%2 uncompiled vs compiled expected: java.lang.Integer<1> but was:
java.math.BigInteger<1>
runTest[51](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5h<<2 uncompiled vs compiled expected: java.lang.Integer<20> but was:
java.math.BigInteger<20>
runTest[52](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5h>>2 uncompiled vs compiled expected: java.lang.Integer<1> but was:
java.math.BigInteger<1>
runTest[53](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5h>>1+1 uncompiled vs compiled expected: java.lang.Integer<1> but was:
java.math.BigInteger<1>
runTest[54](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
-5h>>>2 uncompiled vs compiled expected: java.lang.Integer<-2> but was:
java.math.BigInteger<-2>
runTest[55](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5.b & 3 uncompiled vs compiled expected: java.lang.Long<1> but was:
java.math.BigInteger<1>
runTest[56](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5h ^3 uncompiled vs compiled expected: java.lang.Integer<6> but was:
java.math.BigInteger<6>
runTest[57](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5h&3|5^3 uncompiled vs compiled expected: java.lang.Long<7> but was:
java.math.BigInteger<7>
runTest[58](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
5H&(3|5^3) uncompiled vs compiled expected: java.lang.Long<5> but was:
java.math.BigInteger<5>
runTest[83](org.apache.commons.ognl.test.ArithmeticAndLogicalOperatorsTest):
1 band 0 uncompiled vs compiled expected: java.lang.Long<0> but was:
java.lang.Integer<0>
runTest[4](org.apache.commons.ognl.test.ConstantTest): 1234L uncompiled vs
compiled expected: java.lang.Integer<1234> but was: java.lang.Long<1234>
runTest[7](org.apache.commons.ognl.test.ConstantTest): 12.34f uncompiled vs
compiled expected: java.lang.Double<12.34> but was: java.lang.Float<12.34>
runTest[0](org.apache.commons.ognl.test.IndexedPropertyTest): getValues
uncompiled vs compiled expected:<[Ljava.lang.String;@628f9a32> but
was:<org.apache.commons.ognl.NoSuchPropertyException:
org.apache.commons.ognl.test.objects.Indexed.getValues>
runTest[3](org.apache.commons.ognl.test.MethodTest):
messages.format('ShowAllCount', one) uncompiled vs compiled expected:<f[oo]>
but was:<f[irst]>
runTest[44](org.apache.commons.ognl.test.PropertyTest):
'disableButton(this,"' + map.get('button-testing') +
'");clearElement("testFtpMessage")' uncompiled vs compiled
expected:<disableButton(this,['null');clearElement('testFtpMessage'])> but
was:<disableButton(this,["null");clearElement("testFtpMessage"])>
{code}
can you please help me to understand it is not caused by applying the patch?
Thanks in advance, really appreciated!
moreover, few minor recommendations:
* when importing {{Assert}} class, please use the {{org.junit.Assert}} import;
* when attaching patches, please name them with the issue key in the prefix,
i.e. {{OGNL-40_better_unit_tests.patch}}
TIA!
> Compiled expressions behave differently than uncompiled expressions with same
> object graph.
> -------------------------------------------------------------------------------------------
>
> Key: OGNL-40
> URL: https://issues.apache.org/jira/browse/OGNL-40
> Project: OGNL
> Issue Type: Bug
> Reporter: Daniel Pitts
> Assignee: Simone Tripodi
> Attachments: better_unit_tests.patch
>
>
> I discovered that the same expression string will have different effects if
> it is compiled vs uncompiled. The unit tests currently test mostly "compiled"
> cases, which leaves the possibility of introducing bugs in the uncompiled
> expression handling.
> I'll attatch a patch which compares modifies the unit tests to compare the
> two results. 39 tests fail. Some of them are due to constant "type"
> differences, but there are other types of failures.
--
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