diff options
| author | Lorenzo Colitti <lorenzo@google.com> | 2009-09-16 10:41:38 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2009-09-16 10:41:38 -0700 |
| commit | 120051b4744da2888756d901f9351ebd8e5ae467 (patch) | |
| tree | bbeee71dd35d1f2d3a4c0725ad7c22e2f8d38663 | |
| parent | a28e7d1a32d3883b5b279f5ddc8473e6bcbf6760 (diff) | |
| parent | b257c944e15c5be46a69143603426c7ce137e6a3 (diff) | |
| download | android_dalvik-120051b4744da2888756d901f9351ebd8e5ae467.tar.gz android_dalvik-120051b4744da2888756d901f9351ebd8e5ae467.tar.bz2 android_dalvik-120051b4744da2888756d901f9351ebd8e5ae467.zip | |
am b257c944: Report the cause of name lookup failures to Java land. The Java code already uses the exception thrown by getallbyname() as a chained exception.
Merge commit 'b257c944e15c5be46a69143603426c7ce137e6a3' into eclair-plus-aosp
* commit 'b257c944e15c5be46a69143603426c7ce137e6a3':
Report the cause of name lookup failures to Java land. The Java code already
| -rw-r--r-- | libcore/luni/src/main/native/java_net_InetAddress.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/libcore/luni/src/main/native/java_net_InetAddress.cpp b/libcore/luni/src/main/native/java_net_InetAddress.cpp index 90a88ee85..d7b493171 100644 --- a/libcore/luni/src/main/native/java_net_InetAddress.cpp +++ b/libcore/luni/src/main/native/java_net_InetAddress.cpp @@ -100,7 +100,10 @@ static jobjectArray getAllByNameUsingAdb(JNIEnv* env, const char* name) env->SetByteArrayRegion(byteArray, 0, 4, (jbyte*) &outaddr.s_addr); env->SetObjectArrayElement(addressArray, 1, byteArray); } + } else { + jniThrowException(env, "java/net/UnknownHostException", "adb error"); } + return addressArray; } @@ -189,8 +192,8 @@ static jobjectArray getAllByNameUsingDns(JNIEnv* env, const char* name, env, "java/lang/SecurityException", "Permission denied (maybe missing INTERNET permission)"); } else { - // Do nothing. Return value will be null and the caller will throw an - // UnknownHostExeption. + jniThrowException(env, "java/net/UnknownHostException", + gai_strerror(result)); } if (addressList) { @@ -227,12 +230,6 @@ jobjectArray InetAddress_getallbyname(JNIEnv* env, jobject obj, out = getAllByNameUsingDns(env, name, preferIPv4Stack); } - if (!out) { -#if LOG_DNS - LOGI("Unknown host %s, throwing UnknownHostException", name); -#endif - jniThrowException(env, "java/net/UnknownHostException", name); - } env->ReleaseStringUTFChars(javaName, name); return out; } |
