summaryrefslogtreecommitdiffstats
path: root/core/jni/AndroidRuntime.cpp
diff options
context:
space:
mode:
authorCarl Shapiro <cshapiro@google.com>2010-12-07 16:39:05 -0800
committerCarl Shapiro <cshapiro@google.com>2010-12-07 21:03:56 -0800
commitca7e1ed81ce44090aac17c9599578b1c23db7863 (patch)
tree1047417e7c5eaf5fef1675e14c3046ed26c849f7 /core/jni/AndroidRuntime.cpp
parentdde4c353851fd107ebe122a4ad9328e007c169b9 (diff)
downloadframeworks_base-ca7e1ed81ce44090aac17c9599578b1c23db7863.zip
frameworks_base-ca7e1ed81ce44090aac17c9599578b1c23db7863.tar.gz
frameworks_base-ca7e1ed81ce44090aac17c9599578b1c23db7863.tar.bz2
Remove stale code and unneeded '\n' chars from findClass.
Change-Id: I496d56105a0889eb0a8c492985f8a324a200edc6
Diffstat (limited to 'core/jni/AndroidRuntime.cpp')
-rw-r--r--core/jni/AndroidRuntime.cpp37
1 files changed, 6 insertions, 31 deletions
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index a21f0ab..98bdb52 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -353,33 +353,12 @@ status_t AndroidRuntime::callMain(
*/
jclass AndroidRuntime::findClass(JNIEnv* env, const char* className)
{
- char* convName = NULL;
-
if (env->ExceptionCheck()) {
- LOGE("ERROR: exception pending on entry to findClass()\n");
+ LOGE("ERROR: exception pending on entry to findClass()");
return NULL;
}
/*
- * JNI FindClass uses class names with slashes, but ClassLoader.loadClass
- * uses the dotted "binary name" format. We don't need to convert the
- * name with the new approach.
- */
-#if 0
- /* (convName only created if necessary -- use className) */
- for (char* cp = const_cast<char*>(className); *cp != '\0'; cp++) {
- if (*cp == '.') {
- if (convName == NULL) {
- convName = strdup(className);
- cp = convName + (cp-className);
- className = convName;
- }
- *cp = '/';
- }
- }
-#endif
-
- /*
* This is a little awkward because the JNI FindClass call uses the
* class loader associated with the native method we're executing in.
* Because this native method is part of a "boot" class, JNI doesn't
@@ -394,7 +373,6 @@ jclass AndroidRuntime::findClass(JNIEnv* env, const char* className)
* have to do things the hard way.
*/
jclass cls = NULL;
- //cls = env->FindClass(className);
jclass javaLangClassLoader;
jmethodID getSystemClassLoader, loadClass;
@@ -416,24 +394,21 @@ jclass AndroidRuntime::findClass(JNIEnv* env, const char* className)
/* create an object for the class name string; alloc could fail */
strClassName = env->NewStringUTF(className);
if (env->ExceptionCheck()) {
- LOGE("ERROR: unable to convert '%s' to string\n", className);
- goto bail;
+ LOGE("ERROR: unable to convert '%s' to string", className);
+ return NULL;
}
- LOGV("system class loader is %p, loading %p (%s)\n",
+ LOGV("system class loader is %p, loading %p (%s)",
systemClassLoader, strClassName, className);
/* try to find the named class */
cls = (jclass) env->CallObjectMethod(systemClassLoader, loadClass,
strClassName);
if (env->ExceptionCheck()) {
- LOGE("ERROR: unable to load class '%s' from %p\n",
+ LOGE("ERROR: unable to load class '%s' from %p",
className, systemClassLoader);
- cls = NULL;
- goto bail;
+ return NULL;
}
-bail:
- free(convName);
return cls;
}