|
Last change
on this file since 2230 was 1389, checked in by bird, 22 years ago |
|
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | /* Copyright (C) 2002, 2003 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 <[email protected]>
|
|---|
| 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 | /* 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)
|
|---|
| 32 | {
|
|---|
| 33 | jclass klass = t->classAt(i);
|
|---|
| 34 | if (klass != NULL)
|
|---|
| 35 | return klass->getClassLoaderInternal();
|
|---|
| 36 | }
|
|---|
| 37 | }
|
|---|
| 38 | catch (::java::lang::ArrayIndexOutOfBoundsException *e)
|
|---|
| 39 | {
|
|---|
| 40 | }
|
|---|
| 41 | return NULL;
|
|---|
| 42 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.