src/share/demo/jvmti/hprof/hprof_init.c

Print this page
rev 6641 : [mq]: PrivateTransportTest

@@ -1897,15 +1897,21 @@
     /* The library may be located in different ways, try both, but
      *   if it comes from outside the SDK/jre it isn't ours.
      */
     getSystemProperty("sun.boot.library.path", &boot_path);
     md_build_library_name(lname, FILENAME_MAX, boot_path, name);
+    if ( strlen(lname) == 0 ) {
+        HPROF_ERROR(JNI_TRUE, "Could not find library");
+    }
     jvmtiDeallocate(boot_path);
     handle = md_load_library(lname, err_buf, (int)sizeof(err_buf));
     if ( handle == NULL ) {
         /* This may be necessary on Windows. */
         md_build_library_name(lname, FILENAME_MAX, "", name);
+        if ( strlen(lname) == 0 ) {
+            HPROF_ERROR(JNI_TRUE, "Could not find library");
+        }
         handle = md_load_library(lname, err_buf, (int)sizeof(err_buf));
         if ( handle == NULL ) {
             HPROF_ERROR(JNI_TRUE, err_buf);
         }
     }

@@ -1966,10 +1972,13 @@
 
 #ifndef SKIP_NPT
     getSystemProperty("sun.boot.library.path", &boot_path);
     /* Load in NPT library for character conversions */
     md_build_library_name(npt_lib, sizeof(npt_lib), boot_path, NPT_LIBNAME);
+    if ( strlen(npt_lib) == 0 ) {
+        HPROF_ERROR(JNI_TRUE, "Could not find npt library");
+    }
     jvmtiDeallocate(boot_path);
     NPT_INITIALIZE(npt_lib, &(gdata->npt), NPT_VERSION, NULL);
     if ( gdata->npt == NULL ) {
         HPROF_ERROR(JNI_TRUE, "Cannot load npt library");
     }