Bug 842567 - Incompability in interpretation of CLI scripts in JON3.1 and master
Incompability in interpretation of CLI scripts in JON3.1 and master
Status: CLOSED WONTFIX
Product: RHQ Project
Classification: Other
Component: CLI (Show other bugs)
4.5
Unspecified Unspecified
urgent Severity high (vote)
: ---
: JON 3.1.1
Assigned To: RHQ Project Maintainer
Mike Foley
:
Depends On:
Blocks: 844495
  Show dependency treegraph
 
Reported: 2012-07-24 05:07 EDT by Filip Brychta
Modified: 2012-07-31 05:05 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 844495 (view as bug list)
Environment:
Last Closed: 2012-07-31 05:05:54 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
creatingContentBackedRes.js (6.50 KB, application/javascript)
2012-07-24 05:07 EDT, Filip Brychta
no flags Details
stringTest.js (1.84 KB, application/javascript)
2012-07-24 05:08 EDT, Filip Brychta
no flags Details
output of creatingContentBackedRes.js for JON3.1 (67.89 KB, text/plain)
2012-07-24 05:09 EDT, Filip Brychta
no flags Details
output of creatingContentBackedRes.js for RHQ4.5 (74.76 KB, text/plain)
2012-07-24 05:09 EDT, Filip Brychta
no flags Details
output of stringTest.js for JON3.1 (609 bytes, text/plain)
2012-07-24 05:10 EDT, Filip Brychta
no flags Details
output of stringTest.js for RHQ4.5 (599 bytes, text/plain)
2012-07-24 05:11 EDT, Filip Brychta
no flags Details

  None (edit)
Description Filip Brychta 2012-07-24 05:07:03 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):
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 05:07:55 EDT
Created attachment 599961 [details]
creatingContentBackedRes.js
Comment 2 Filip Brychta 2012-07-24 05:08:25 EDT
Created attachment 599963 [details]
stringTest.js
Comment 3 Filip Brychta 2012-07-24 05:09:16 EDT
Created attachment 599964 [details]
output of creatingContentBackedRes.js for JON3.1
Comment 4 Filip Brychta 2012-07-24 05:09:48 EDT
Created attachment 599965 [details]
output of creatingContentBackedRes.js for RHQ4.5
Comment 5 Filip Brychta 2012-07-24 05:10:55 EDT
Created attachment 599967 [details]
output of stringTest.js for JON3.1
Comment 6 Filip Brychta 2012-07-24 05:11:40 EDT
Created attachment 599968 [details]
output of stringTest.js for RHQ4.5
Comment 7 Lukas Krejci 2012-07-30 12:55:57 EDT
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 18:31:57 EDT
Note that this is now fixed in master by the means of bug 844495.
Comment 9 Charles Crouch 2012-07-30 21:14:11 EDT
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 05:05:54 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.