From 7d67d135c0b56014f87af983657999b2ad2408a6 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 26 Mar 2008 20:47:15 +0000 Subject: [PATCH] propagate ptql errors --- bindings/java/src/jni/win32/service.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bindings/java/src/jni/win32/service.cpp b/bindings/java/src/jni/win32/service.cpp index 516ba704..96d7d93e 100644 --- a/bindings/java/src/jni/win32/service.cpp +++ b/bindings/java/src/jni/win32/service.cpp @@ -230,6 +230,7 @@ JNIEXPORT jobject SIGAR_JNI(win32_Service_getServiceNames) jsigar_list_t obj; sigar_t *sigar = NULL; char *ptql = NULL; + sigar_ptql_error_t error; sigar_services_walker_t walker; jboolean is_copy; @@ -249,7 +250,7 @@ JNIEXPORT jobject SIGAR_JNI(win32_Service_getServiceNames) jsigar_list_init(env, &obj); - status = sigar_services_query(ptql, NULL, &walker); + status = sigar_services_query(ptql, &error, &walker); if (ptql && is_copy) { env->ReleaseStringUTFChars(jptql, ptql); @@ -257,7 +258,12 @@ JNIEXPORT jobject SIGAR_JNI(win32_Service_getServiceNames) if (status != SIGAR_OK) { env->DeleteLocalRef(obj.obj); - win32_throw_error(env, status); + if (status == SIGAR_PTQL_MALFORMED_QUERY) { + win32_throw_exception(env, error.message); + } + else { + win32_throw_error(env, status); + } return NULL; }