summaryrefslogtreecommitdiffstats
path: root/icu/src/main/native
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2010-01-28 13:43:39 -0800
committerElliott Hughes <enh@google.com>2010-01-28 13:43:39 -0800
commitda4f31de172364cfb3a20caed1784fa23b0510ca (patch)
tree8193ad1a81ce51bab2af642fc6cac52c7c7f4c87 /icu/src/main/native
parent230cc3ea6367b9819b20812026ffe52da873e23a (diff)
downloadlibcore-da4f31de172364cfb3a20caed1784fa23b0510ca.zip
libcore-da4f31de172364cfb3a20caed1784fa23b0510ca.tar.gz
libcore-da4f31de172364cfb3a20caed1784fa23b0510ca.tar.bz2
Fix jniThrowRuntimeException for C callers, add jniThrowNullPointerException.
...and switch all NPE throwers over to the helper.
Diffstat (limited to 'icu/src/main/native')
-rw-r--r--icu/src/main/native/ErrorCode.cpp2
-rw-r--r--icu/src/main/native/NativeDecimalFormat.cpp9
-rw-r--r--icu/src/main/native/NativeRegEx.cpp5
-rw-r--r--icu/src/main/native/UCharacter.cpp2
4 files changed, 6 insertions, 12 deletions
diff --git a/icu/src/main/native/ErrorCode.cpp b/icu/src/main/native/ErrorCode.cpp
index 94c4239..a9d0691 100644
--- a/icu/src/main/native/ErrorCode.cpp
+++ b/icu/src/main/native/ErrorCode.cpp
@@ -34,6 +34,6 @@ UBool icu4jni_error(JNIEnv *env, UErrorCode errorCode)
case U_UNSUPPORTED_ERROR:
return jniThrowException(env, "java/lang/UnsupportedOperationException", message);
default:
- return jniThrowException(env, "java/lang/RuntimeException", message);
+ return jniThrowRuntimeException(env, message);
}
}
diff --git a/icu/src/main/native/NativeDecimalFormat.cpp b/icu/src/main/native/NativeDecimalFormat.cpp
index ba62726..9170f27 100644
--- a/icu/src/main/native/NativeDecimalFormat.cpp
+++ b/icu/src/main/native/NativeDecimalFormat.cpp
@@ -29,18 +29,13 @@
#include <stdlib.h>
#include <string.h>
-// FIXME: move to JNIHelp.h
-static void jniThrowNullPointerException(JNIEnv* env) {
- jniThrowException(env, "java/lang/NullPointerException", NULL);
-}
-
static DecimalFormat* toDecimalFormat(jint addr) {
return reinterpret_cast<DecimalFormat*>(static_cast<uintptr_t>(addr));
}
static jint openDecimalFormatImpl(JNIEnv* env, jclass clazz, jstring pattern0) {
if (pattern0 == NULL) {
- jniThrowNullPointerException(env);
+ jniThrowNullPointerException(env, NULL);
return 0;
}
@@ -218,7 +213,7 @@ static jstring getTextAttribute(JNIEnv *env, jclass clazz, jint addr,
static void applyPatternImpl(JNIEnv *env, jclass clazz, jint addr, jboolean localized, jstring pattern0) {
if (pattern0 == NULL) {
- jniThrowNullPointerException(env);
+ jniThrowNullPointerException(env, NULL);
return;
}
ScopedJavaUnicodeString pattern(env, pattern0);
diff --git a/icu/src/main/native/NativeRegEx.cpp b/icu/src/main/native/NativeRegEx.cpp
index 387d7e4..7b3cafc 100644
--- a/icu/src/main/native/NativeRegEx.cpp
+++ b/icu/src/main/native/NativeRegEx.cpp
@@ -54,9 +54,8 @@ static void throwPatternSyntaxException(JNIEnv* env, UErrorCode status,
env->Throw(except);
}
-static void throwRuntimeException(JNIEnv* env, UErrorCode status)
-{
- jniThrowException(env, "java/lang/RuntimeException", u_errorName(status));
+static void throwRuntimeException(JNIEnv* env, UErrorCode status) {
+ jniThrowRuntimeException(env, u_errorName(status));
}
static void _close(JNIEnv* env, jclass clazz, RegExData* data)
diff --git a/icu/src/main/native/UCharacter.cpp b/icu/src/main/native/UCharacter.cpp
index c13b6d3..3fd8151 100644
--- a/icu/src/main/native/UCharacter.cpp
+++ b/icu/src/main/native/UCharacter.cpp
@@ -138,7 +138,7 @@ static jboolean isLowerCaseImpl(JNIEnv*, jclass, jint codePoint) {
static int forNameImpl(JNIEnv* env, jclass, jstring blockName) {
if (blockName == NULL) {
- jniThrowException(env, "java/lang/NullPointerException", NULL);
+ jniThrowNullPointerException(env, NULL);
return -1;
}
const char* bName = env->GetStringUTFChars(blockName, NULL);