pjs/js
norris%netscape.com abc0613496 Fix the following problem:
Subject:
        ImporterTopLevel problem
   Date:
        Fri, 6 Aug 1999 15:42:50 -0400
   From:
        "\"Howard\" Xuhua Lin" <howard@softcom.com>
     To:
        "Norris Boyd" <norris@netscape.com>
    CC:
        "Andrew Wason" <aw@softcom.com>




Hi, The following script will cause an EvaluatorException: Ambiguous import: [JavaPackage java.awt.JButton] and [JavaPackage
java.awt.Packages.javax.swing.JButton] in the js shell:

js>importPackage(java.awt);
js>importPackage(Packages.javax.swing);
js>new JButton();.

The current JS shell will not print this exception message, even though the comment says "// Already printed message, so just fall
through". I add System.err.println(ee.getMessage()); for this exception.

The problem is that in NativeJavaPackage.get(String, Scriptable) method, if a ClassNotFoundException is caught, a
NativeJavaPackage object is created and passed back to ImporterTopLevel.get Method. So in ImporterTopLevel.get method, object v
is always not NOT_FOUND and the ambiguous exception will be thrown. Object v is supposed to be a Class object but it actually is
a Package object.

The fix can be either (1) in NativeJavaPackage.get(String, Scriptable) method, if a ClassNotFoundException is caught, return a
NOT_FOUND object (you may still create a Package object) or (2) in ImporterTopLevel.get method, make sure the returned object
from NativeJavaPackage.get method is of NativeJavaClass type.

Howard
1999-08-12 16:59:29 +00:00
..
benchmarks Add benchmarks. 1999-06-04 18:44:17 +00:00
js2/java Changes to get traditional functions with args. working 1999-06-15 00:57:05 +00:00
jsd updating readme 1999-06-01 02:31:13 +00:00
jsdj Change MOZILLA_HOME to MOZILLA_FIVE_HOME so that we dont fight Communicator 1999-03-11 20:00:57 +00:00
jsj Deleting obsolete contents of jsj directory 1998-09-24 00:32:24 +00:00
macbuild added files: mozilla/js/src/xpconnect/idl/xpctest2.idl 1999-07-16 20:35:58 +00:00
ref The files in this directory are all obsolete. JavaScript development 1998-10-16 22:18:00 +00:00
rhino Fix the following problem: 1999-08-12 16:59:29 +00:00
semantics Updated for recent semantic engine changes. Changed the meaning of (?= to match Perl. 1999-07-27 01:05:59 +00:00
src Changes to the xpidl compiler - 1999-08-10 12:18:01 +00:00
tests Fixed lastIndex test - value is ignored for non-global regexp. 1999-08-11 04:31:19 +00:00
.cvsignore more anal tricks. 1999-06-26 05:01:40 +00:00
Makefile.in Adding libxpt and xpconnect to the build. 1999-03-25 07:50:11 +00:00
landbranch.pl Tweaks 1999-04-27 05:08:14 +00:00
makefile.win removed jsj for MOZ_JAVA 1998-08-01 00:03:31 +00:00