This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[3.4] Patch: fix Class.getClassLoader() infinite recursion


Some of the mauve java.util.logging tests go into infinite recursion
between Class.getClassLoader() and ClassLoader.getSystemClassLoader().

Those tests load their own SecurityManager, which forces a separate code
path in Class.getClassLoader() and ClassLoader.getSystemClassLoader()
and we bounce back and forth between these functions forever.

This patch fixes.  No new regressions, but many new mauve passes.  Ok
for 3.4 and HEAD?


2004-03-21  Anthony Green  <green@redhat.com>

	* java/lang/natClass.cc (getClassLoader): Circumvent infinite
	recursion when searching for the system ClassLoader.


Index: libjava/java/lang/natClass.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natClass.cc,v
retrieving revision 1.74
diff -c -p -r1.74 natClass.cc
*** libjava/java/lang/natClass.cc	3 Dec 2003 21:26:59 -0000	1.74
--- libjava/java/lang/natClass.cc	21 Mar 2004 15:42:05 -0000
*************** java::lang::Class::getClassLoader (void)
*** 151,157 ****
    // `null' instead.
    if (isPrimitive ())
      return NULL;
!   return loader ? loader : ClassLoader::getSystemClassLoader ();
  }
  
  java::lang::reflect::Constructor *
--- 151,157 ----
    // `null' instead.
    if (isPrimitive ())
      return NULL;
!   return loader ? loader : ClassLoader::systemClassLoader;
  }
  
  java::lang::reflect::Constructor *



AG

-- 
Anthony Green <green@redhat.com>
Red Hat, Inc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]