Bug 842567

Summary: Incompability in interpretation of CLI scripts in JON3.1 and master
Product: [Other] RHQ Project Reporter: Filip Brychta <fbrychta>
Component: CLIAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED WONTFIX QA Contact: Mike Foley <mfoley>
Severity: high Docs Contact:
Priority: urgent    
Version: 4.5CC: hrupp, lkrejci
Target Milestone: ---   
Target Release: JON 3.1.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 844495 (view as bug list) Environment:
Last Closed: 2012-07-31 09:05:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 844495    
Attachments:
Description Flags
creatingContentBackedRes.js
none
stringTest.js
none
output of creatingContentBackedRes.js for JON3.1
none
output of creatingContentBackedRes.js for RHQ4.5
none
output of stringTest.js for JON3.1
none
output of stringTest.js for RHQ4.5 none

Description Filip Brychta 2012-07-24 09:07:03 UTC
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):
Version: 4.5.0-SNAPSHOT
Build Number: 0170a5a

How reproducible:
Always

Additional info:
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:'

Comment 1 Filip Brychta 2012-07-24 09:07:55 UTC
Created attachment 599961 [details]
creatingContentBackedRes.js

Comment 2 Filip Brychta 2012-07-24 09:08:25 UTC
Created attachment 599963 [details]
stringTest.js

Comment 3 Filip Brychta 2012-07-24 09:09:16 UTC
Created attachment 599964 [details]
output of creatingContentBackedRes.js for JON3.1

Comment 4 Filip Brychta 2012-07-24 09:09:48 UTC
Created attachment 599965 [details]
output of creatingContentBackedRes.js for RHQ4.5

Comment 5 Filip Brychta 2012-07-24 09:10:55 UTC
Created attachment 599967 [details]
output of stringTest.js for JON3.1

Comment 6 Filip Brychta 2012-07-24 09:11:40 UTC
Created attachment 599968 [details]
output of stringTest.js for RHQ4.5

Comment 7 Lukas Krejci 2012-07-30 16:55:57 UTC
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.

Comment 8 Lukas Krejci 2012-07-30 22:31:57 UTC
Note that this is now fixed in master by the means of bug 844495.

Comment 9 Charles Crouch 2012-07-31 01:14:11 UTC
I think this got erroneously set to be fixed in 311
Lukas
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.

Comment 10 Lukas Krejci 2012-07-31 09:05:54 UTC
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.