Hi All,

I recently discovered some inconsistency in UnixOperatingSystem_md.c
that do now return -1 after throwing internal error. It usually
shouldn't be a problem, but making it more consistent to other code
within the same file shouldn't be a bad idea.

Xiaoguang
exporting patch:
# HG changeset patch
# User Xiaoguang Sun <sunxiaogu...@gmail.com>
# Date 1413212027 -28800
#      Mon Oct 13 22:53:47 2014 +0800
# Node ID 30570cba688d636a9ad6e8ed0a627ac0cf402867
# Parent  992b39afdcb97fa44547d844ce57a32f3e52bd7a
Return -1 after throwing internal error

diff -r 992b39afdcb9 -r 30570cba688d src/solaris/native/com/sun/management/UnixOperatingSystem_md.c
--- a/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c	Thu Jun 13 09:48:58 2013 -0700
+++ b/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c	Mon Oct 13 22:53:47 2014 +0800
@@ -152,6 +152,7 @@
     ret = sysinfo(&si);
     if (ret != 0) {
         throw_internal_error(env, "sysinfo failed to get swap size");
+        return -1;
     }
     total = (jlong)si.totalswap * si.mem_unit;
     avail = (jlong)si.freeswap * si.mem_unit;
@@ -162,6 +163,7 @@
     size_t size = sizeof(vmusage);
     if (sysctlbyname("vm.swapusage", &vmusage, &size, NULL, 0) != 0) {
         throw_internal_error(env, "sysctlbyname failed");
+        return -1;
     }
     return available ? (jlong)vmusage.xsu_avail : (jlong)vmusage.xsu_total;
 #else /* _ALLBSD_SOURCE */
@@ -237,6 +239,7 @@
     kern_return_t res = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&t_info, &t_info_count);
     if (res != KERN_SUCCESS) {
         throw_internal_error(env, "task_info failed");
+        return -1;
     }
     return t_info.virtual_size;
 #else /* _ALLBSD_SOURCE */

Reply via email to