Bug 842567 - Incompability in interpretation of CLI scripts in JON3.1 and master
Summary: Incompability in interpretation of CLI scripts in JON3.1 and master
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: RHQ Project
Classification: Other
Component: CLI
Version: 4.5
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: ---
: JON 3.1.1
Assignee: RHQ Project Maintainer
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks: 844495
TreeView+ depends on / blocked
 
Reported: 2012-07-24 09:07 UTC by Filip Brychta
Modified: 2012-07-31 09:05 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
: 844495 (view as bug list)
Environment:
Last Closed: 2012-07-31 09:05:54 UTC
Embargoed:


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

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.


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