Menu

#6 Unnecessary warning for Import.forName

closed
None
5
2004-05-20
2002-07-21
Bill Hale
No

When I use "import java.util.*" for example,
I get warning messages when a class like
"Random" is eventually looked up in an applet.
These messages don't appear for an application.

I suspect this is a known problem since
it is documented in the code!

It seems that the warnings are being generated
as it runs through the possible wildcard import
statements that have been declared up to that
point. It seems that an error message (not
a warning) should be generated only if no
match is found at the end.

Can this problem be fixed?

The relevent code is the following (I believe):

==================================================
/** Ask the ClassLoader for a class given its full
name. **/
public static Class forName(String name) {
ClassLoader loader = getClassLoader();
if (loader == null)
try { return Class.forName(name);}
catch (ClassNotFoundException e) { return null;}
else
try { return loader.loadClass(name); }
catch (ClassNotFoundException e) { return null; }
// KRA 28JUN00: Renu found this!
catch (NoClassDefFoundError e) { return null; }
catch (Throwable t) {
// In an https applet java.lang.ClassFormatError
happens when
// Looking up wildcards.
// System.err.println("This happened looking for
class " + name);
// t.printStackTrace();
E.warn("Import.forName(" + name + ") got:");
t.printStackTrace();
System.err.println("returning null!");
return null;
}
}
==================================================

-- Bill Hale

Discussion

  • Bill Hale

    Bill Hale - 2002-08-16

    Logged In: YES
    user_id=5634

    I think this problem has already been fixed
    with patches done after the April version,
    which version I was using.

    I finally got a CVS program to download
    the current cvs, and the problem no longer
    exists.

    -- Bill Hale

     
  • Ken Anderson

    Ken Anderson - 2004-05-20
    • assigned_to: nobody --> kanderso
    • status: open --> closed
     
  • Ken Anderson

    Ken Anderson - 2004-05-20

    Logged In: YES
    user_id=18278

    I think this code is no longer in the current version of
    JScheme.

     

Log in to post a comment.

MongoDB Logo MongoDB