Closed
Bug 518237
Opened 15 years ago
Closed 15 years ago
Problem with Java packages that starts with "br."
Categories
(Rhino Graveyard :: Core, defect)
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: rossato, Unassigned)
Details
Attachments
(3 files)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.21 Safari/532.0 Build Identifier: My packages begin with "br" (I'm from Brazil), for instance, br.com.todobpo (this is the package prefix we use at the company I work). Every time I try to execute a method that makes reference to a Java object that matches this criteria the engine throws the following exception: javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "br" is not defined. (<Unknown source>#1) in <Unknown source> at line number 1 at com.sun.script.javascript.RhinoScriptEngine.invoke(RhinoScriptEngine.java:184) at com.sun.script.javascript.RhinoScriptEngine.invokeFunction(RhinoScriptEngine.java:142) at Main.main(Main.java:25) Reproducible: Always Actual Results: javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "br" is not defined. (<Unknown source>#1) in <Unknown source> at line number 1 at com.sun.script.javascript.RhinoScriptEngine.invoke(RhinoScriptEngine.java:184) at com.sun.script.javascript.RhinoScriptEngine.invokeFunction(RhinoScriptEngine.java:142) at Main.main(Main.java:25) Expected Results: No exception? :P
Reporter | ||
Comment 1•15 years ago
|
||
Reporter | ||
Comment 2•15 years ago
|
||
Reporter | ||
Comment 3•15 years ago
|
||
Reporter | ||
Comment 4•15 years ago
|
||
We can use the attached source code to reproduce the bug.
Comment 5•15 years ago
|
||
"com" is one of the top level package prefixes that is automatically assigned to a property on the global object in the Rhino shell, so I guess that ScriptEngineManager.getEngineByExtension() also does this import. You will need to do either: String code = "function execute() { Packages.br.test.DoSomething.doSomething(); }"; or evaluate the statement "br = Packages.br" before referencing classes underneath br.
Comment 6•15 years ago
|
||
Cameron is correct. Sorry for the difficulty. Marking as invalid.
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → INVALID
Reporter | ||
Comment 7•15 years ago
|
||
It worked! Thank you guys for the quick response.
You need to log in
before you can comment on or make changes to this bug.
Description
•