From 9f02386426b5bb5d931e92c80060fad06b693dd2 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Sun, 19 Aug 2007 00:07:10 +0000
Subject: [PATCH] Fix for issue 2112.

---
 opends/resource/Messages.java.stub |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/opends/resource/Messages.java.stub b/opends/resource/Messages.java.stub
index 4ca5028..95dc265 100644
--- a/opends/resource/Messages.java.stub
+++ b/opends/resource/Messages.java.stub
@@ -41,6 +41,53 @@
   /** Base property for resource bundle containing messages */
   static private final String BASE = "${BASE}";
 
+  static private ClassLoader webstartClassLoader;
+
   ${MESSAGES}
 
+ /**
+  * Returns the Class Loader to be used to get the ResourceBundle,
+  * it returns <CODE>null</CODE> if the default ClassLoader is to be
+  * used.
+  * @return the Class Loader to be used to get the ResourceBundle,
+  * it returns <CODE>null</CODE> if the default ClassLoader is to be
+  * used.
+  */
+  private static ClassLoader getClassLoader()
+  {
+    ClassLoader cl;
+    if (${USE_MESSAGE_JAR_IF_WEBSTART})
+    {
+      if (org.opends.server.util.SetupUtils.isWebStart())
+      {
+        if (webstartClassLoader == null)
+        {
+          try
+          {
+            Class c = Class.forName("${PACKAGE}.${CLASS_NAME}");
+
+            java.net.URL[] urls = new java.net.URL[] {
+                c.getProtectionDomain().getCodeSource().getLocation()
+            };
+            webstartClassLoader = new java.net.URLClassLoader(urls);
+          }
+          catch (ClassNotFoundException cnfe)
+          {
+            // This cannot happen as we are looking for this class so it is
+            // already found.
+          }
+        }
+        cl = webstartClassLoader;
+      }
+      else
+      {
+        cl = null;
+      }
+    }
+    else
+    {
+      cl = null;
+    }
+    return cl;
+  }
 }

--
Gitblit v1.10.0