Red Hat Bugzilla – Bug 842567
Incompability in interpretation of CLI scripts in JON3.1 and master
Last modified: 2012-07-31 05:05:54 EDT
Description of problem:
The same CLI script is interpreted differently in JON3.1 and master. Found difference:
Concatenation in JON3.1 results into string, but in master into object -> problems:
1 - conString.length() is working for master but not for JON3.1
2 -(conString == objectWithTheSameString) is true in JON3.1 (comparing string with object), but in master is false (comparing two objects)
Version-Release number of selected component (if applicable):
Build Number: 0170a5a
See attached scripts and theirs outputs for JON3.1 and master. In stringTestOutput* you can see that concatenation results into different types in JON3.1 and master. In creatingContentBackedResOutput* you can see that condition was resolved differently for JON3.1 and master. Search for 'Comparing: 'MiscBeans.ear' with 'MiscBeans.ear'' You can see there the problem with length() vs. length as well, search for 'size of childname and packagename:'
Created attachment 599961 [details]
Created attachment 599963 [details]
Created attachment 599964 [details]
output of creatingContentBackedRes.js for JON3.1
Created attachment 599965 [details]
output of creatingContentBackedRes.js for RHQ4.5
Created attachment 599967 [details]
output of stringTest.js for JON3.1
Created attachment 599968 [details]
output of stringTest.js for RHQ4.5
After playing with this I see the following problem:
var a = "str"
var b = "str"
var test1 = a + b
var test2 = "strstr"
var test3 = new java.lang.String("strstr")
test1 == test2 //= true
test1 == test3 //= false, should be true
test2 == test3 //= true
The strange thing is that the above seems to work in the "raw" Rhino shell, which suggests that the bug must lie somewhere in the script engine or the RHQ's wrapper.
Note that this is now fixed in master by the means of bug 844495.
I think this got erroneously set to be fixed in 311
Can you confirm this issue only ever appeared in master, so there is no need for a 311 fix? If so, please close this out.
Closing. The scripting refactoring was never introduced into JON 311 and so this fix only makes sense in master. Bug 844495 fixed it in there.