OSDN Git Service

adb83f92b26154afd57c1ea9695a9b1b4b347598
[pf3gnuchains/gcc-fork.git] / libjava / java / util / natResourceBundle.cc
1 /* Copyright (C) 2002  Free Software Foundation
2
3    This file is part of libgcj.
4
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
7 details.  */
8
9 // Written by Tom Tromey <tromey@redhat.com>
10
11 #include <config.h>
12
13 #include <gcj/cni.h>
14 #include <jvm.h>
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>
21
22 java::lang::ClassLoader *
23 java::util::ResourceBundle::getCallingClassLoader ()
24 {
25   gnu::gcj::runtime::StackTrace *t = new gnu::gcj::runtime::StackTrace(6);
26   try
27     {
28       for (int i = 3; ; ++i)
29         {
30           jclass klass = t->classAt(i);
31           if (klass != NULL)
32             return klass->getClassLoaderInternal();
33         }
34     }
35   catch (::java::lang::ArrayIndexOutOfBoundsException *e)
36     {
37     }
38   return NULL;
39 }