Bug 844495 - Incompability in interpretation of CLI scripts in JON3.1 and master
Incompability in interpretation of CLI scripts in JON3.1 and master
Status: CLOSED CURRENTRELEASE
Product: RHQ Project
Classification: Other
Component: CLI (Show other bugs)
4.5
Unspecified Unspecified
urgent Severity high (vote)
: ---
: RHQ 4.5.0
Assigned To: RHQ Project Maintainer
Mike Foley
:
Depends On: 842567
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-30 18:23 EDT by Lukas Krejci
Modified: 2013-09-01 06:01 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 842567
Environment:
Last Closed: 2013-09-01 06:01:38 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Lukas Krejci 2012-07-30 18:23:16 EDT
+++ This bug was initially created as a clone of Bug #842567 +++

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

--- Additional comment from fbrychta@redhat.com on 2012-07-24 05:07:55 EDT ---

Created attachment 599961 [details]
creatingContentBackedRes.js

--- Additional comment from fbrychta@redhat.com on 2012-07-24 05:08:25 EDT ---

Created attachment 599963 [details]
stringTest.js

--- Additional comment from fbrychta@redhat.com on 2012-07-24 05:09:16 EDT ---

Created attachment 599964 [details]
output of creatingContentBackedRes.js for JON3.1

--- Additional comment from fbrychta@redhat.com on 2012-07-24 05:09:48 EDT ---

Created attachment 599965 [details]
output of creatingContentBackedRes.js for RHQ4.5

--- Additional comment from fbrychta@redhat.com on 2012-07-24 05:10:55 EDT ---

Created attachment 599967 [details]
output of stringTest.js for JON3.1

--- Additional comment from fbrychta@redhat.com on 2012-07-24 05:11:40 EDT ---

Created attachment 599968 [details]
output of stringTest.js for RHQ4.5

--- Additional comment from lkrejci@redhat.com on 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 1 Lukas Krejci 2012-07-30 18:27:20 EDT
master http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commitdiff;h=f4484a83507fa1f45ea18e5862dceb376efeda1c
Author: Lukas Krejci <lkrejci@redhat.com>
Date:   Tue Jul 31 00:24:17 2012 +0200

    [BZ 844495] - Fixing the inconsistency in the string handling introduced by
    Rhino 1.7R4. The new version of Rhino introduced some performance
    optimizations in the script concatenation which confused the script engine,
    which is based on the previous versions of Rhino.
Comment 2 Heiko W. Rupp 2013-09-01 06:01:38 EDT
Bulk closing of items that are on_qa and in old RHQ releases, which are out for a long time and where the issue has not been re-opened since.

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