1 /* Copyright (C) 2002, 2003 Free Software Foundation
3 This file is part of libgcj.
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9 // Written by Tom Tromey <tromey@redhat.com>
15 #include <java/util/ResourceBundle.h>
16 #include <java/lang/SecurityManager.h>
17 #include <java/lang/ClassLoader.h>
18 #include <java/lang/Class.h>
19 #include <java/lang/ArrayIndexOutOfBoundsException.h>
20 #include <gnu/gcj/runtime/StackTrace.h>
22 java::lang::ClassLoader
*
23 java::util::ResourceBundle::getCallingClassLoader ()
25 gnu::gcj::runtime::StackTrace
*t
= new gnu::gcj::runtime::StackTrace(6);
28 /* Frame 0 is this method, frame 1 is getBundle, so starting at
29 frame 2 we might see the user's class. FIXME: should account
30 for reflection, JNI, etc, here. */
31 for (int i
= 2; ; ++i
)
33 jclass klass
= t
->classAt(i
);
35 return klass
->getClassLoaderInternal();
38 catch (::java::lang::ArrayIndexOutOfBoundsException
*e
)