# HG changeset patch
# User ksrini
# Date 1383014349 0
#      Tue Oct 29 02:39:09 2013 +0000
# Node ID a5d00a180798f25254bf6f15b7dc31a0d5df60c2
# Parent  5896fe42b0a429fb5be7abee630b98fa2ec00df3
8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
Reviewed-by: dholmes, anthony, ahgross, erikj, omajid

diff -r 5896fe42b0a4 -r a5d00a180798 src/solaris/bin/java_md.c
--- openjdk/jdk/src/solaris/bin/java_md.c	Wed Aug 07 16:51:59 2013 +0400
+++ openjdk/jdk/src/solaris/bin/java_md.c	Tue Oct 29 02:39:09 2013 +0000
@@ -46,6 +46,10 @@
 #define JVM_DLL "libjvm.so"
 #define JAVA_DLL "libjava.so"
 
+#define JRE_ERROR1      "Error: Could not find Java SE Runtime Environment."
+#define JRE_ERROR11     "Error: Path length exceeds maximum length (PATH_MAX)"
+#define JRE_ERROR13     "Error: String processing operation failed"
+
 /*
  * If a processor / os combination has the ability to run binaries of
  * two data models and cohabitation of jre/jdk bits with both data
@@ -1700,7 +1704,28 @@
 
 void* SplashProcAddress(const char* name) {
     if (!hSplashLib) {
-        hSplashLib = dlopen(SPLASHSCREEN_SO, RTLD_LAZY | RTLD_GLOBAL);
+        int ret;
+        char jrePath[MAXPATHLEN];
+        char splashPath[MAXPATHLEN];
+
+        if (!GetJREPath(jrePath, sizeof(jrePath), GetArch(), JNI_FALSE)) {
+            ReportErrorMessage(JRE_ERROR1, JNI_TRUE);
+            return NULL;
+        }
+        ret = snprintf(splashPath, sizeof(splashPath), "%s/lib/%s/%s",
+		       jrePath, GetArch(), SPLASHSCREEN_SO);
+
+        if (ret >= (int) sizeof(splashPath)) {
+            ReportErrorMessage(JRE_ERROR11, JNI_TRUE);
+            return NULL;
+        }
+        if (ret < 0) {
+            ReportErrorMessage(JRE_ERROR13, JNI_TRUE);
+            return NULL;
+        }
+        hSplashLib = dlopen(splashPath, RTLD_LAZY | RTLD_GLOBAL);
+	if (_launcher_debug)
+	  printf("Info: loaded %s\n", splashPath);
     }
     if (hSplashLib) {
         void* sym = dlsym(hSplashLib, name);
