Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 1069676 - samples/util.js script is not compatible with a 1.7 jdk
samples/util.js script is not compatible with a 1.7 jdk
Status: CLOSED NOTABUG
Product: JBoss Operations Network
Classification: JBoss
Component: CLI (Show other bugs)
JON 3.1.2,JON 3.2
Unspecified Unspecified
medium Severity medium
: ---
: JON 3.3.0
Assigned To: RHQ Project Maintainer
Mike Foley
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-25 08:54 EST by dsteigne
Modified: 2014-09-05 17:07 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-09-05 17:07:07 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 733213 None None None Never

  None (edit)
Description dsteigne 2014-02-25 08:54:42 EST
Description of problem:
samples/util.js script is not compatible with a 1.7 jdk

Version-Release number of selected component (if applicable):
3.1.2 and 3.2.0

How reproducible:
Always

Steps to Reproduce:
1. edit the rhq-cli-env file to point the RHQ_CLI_JAVA_HOME variable to a 1.7 jdk
2. login with rhq-cli
3. load the util.js exec -f samples/util.js

Actual results:
Received error:

InterpretedFunction:
        debuggableView: sun.org.mozilla.javascript.InterpreterData@58e395e8
configurationk'getMapVWk'valuesVWkiteratorVWQtViteratork'hasNextVWWT'...
          functionName: asHash
                script: false

Expected results:
the util.js script loads and returns to the prompt as it does with a 1.6 jdk

Additional info:
Comment 4 Libor Zoubek 2014-02-25 11:54:27 EST
Which version of JDK do you use? 

I've verified it works on:
Oracle:
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

and OpenJDK:
java version "1.7.0_45"
OpenJDK Runtime Environment (rhel-2.4.3.3.el6-x86_64 u45-b15)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)

and IBM:
java version "1.7.0"
Java(TM) SE Runtime Environment (build pxa6470sr4ifix-20130305_01(SR4+IV37419))
IBM J9 VM (build 2.6, JRE 1.7.0 Linux amd64-64 Compressed References 20130205_137358 (JIT enabled, AOT enabled)
J9VM - R26_Java726_SR4_20130205_1656_B137358
JIT  - r11.b03_20130131_32403
GC   - R26_Java726_SR4_20130205_1656_B137358_CMPRSS
J9CL - 20130205_137358)
JCL - 20130303_01 based on Oracle 7u13-b08

by "works" I mean:

rhqadmin@localhost:7080$ exec -f samples/util.js
InterpretedFunction:
                         allIds: [arguments, prototype, name, arity, length]
                          arity: 1
                     attributes:
                      className: Function
                 debuggableView: org.mozilla.javascript.InterpreterData@47117da8
                          empty: true
configurationl'getMapWXl'valuesWXliteratorWXRuWiteratorl'hasNe...
                     extensible: true
                   functionName: asHash
                            ids: []
        immunePrototypeProperty:
                         length: 1
                    parentScope: org.rhq.scripting.javascript.engine.ExternalScriptable@4d50c50b
                      prototype: org.mozilla.javascript.BaseFunction@71b87cd4
                         script: false
                         sealed: false
                         typeOf: function

This is not an error, this is just printed representation of module. Import is successful, I can successfully any function from util.js module. Tried also on Oracle JDK1.6 and it behaves exactly like this.
Comment 5 dsteigne 2014-02-25 12:01:21 EST
When I use a JDK 1.6 I don't get the printed message, it just returns to the cli prompt.  If it's not an error but a printed representation, then the customer and I were both mistaken.  I have the customer test the functions.

customer is using 

java version "1.7.0_51"
OpenJDK Runtime Environment (rhel-2.4.4.1.el6_5-x86_64 u51-b02)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)
Comment 7 Lukas Krejci 2014-09-01 07:54:42 EDT
When executing the script using -f option, we print the result of the execution. This is the result of the last statement in that script.

The old version of Rhino (javascript interpreter) that is used in JON 3.1.x with Java6 most probably didn't return the function object as the result of its declaration in the file.

I suppose the following will happen in the combinations of JON and JDK versions:

JON    | JDK | Result
------------------------------
3.1.x  | 1.6 | nothing printed
3.1.x  | 1.7 | stuff printed
3.2.x  | 1.6 | stuff printed
3.2.x  | 1.7 | stuff printed

3.2.x with Java6 SHOULD produce the output because in 3.2.x we no longer use Rhino bundled with the JDK but use our own.

As Libor said above, this is not an error per se but a consequence of trying to print the result of the script running (which is something we've been doing since day 1).

What's printed is the representation of the asHash function that happens to be defined as the last one in samples/util.js.

I suggest closing this as NOTABUG, because "fixing" this would be a change in behavior of the exec command (the fix would be to not print the result of the script execution but only let the script print stuff to output).
Comment 8 Jay Shaughnessy 2014-09-05 17:07:07 EDT
Agreed, working as expected and well-explained for necessary customer feedback.

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