Author: ilya
Date: 2005-06-19 05:09:48 -0400 (Sun, 19 Jun 2005)
New Revision: 46204

Modified:
   trunk/mcs/class/System.Web/System.Web/CapabilitiesLoader.cs
Log:


Modified: trunk/mcs/class/System.Web/System.Web/CapabilitiesLoader.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/CapabilitiesLoader.cs 2005-06-19 
04:44:55 UTC (rev 46203)
+++ trunk/mcs/class/System.Web/System.Web/CapabilitiesLoader.cs 2005-06-19 
09:09:48 UTC (rev 46204)
@@ -181,7 +181,9 @@
                        lock (lockobj) {
                                if (loaded)
                                        return;
-
+#if TARGET_J2EE
+                               string filepath = "browscap.ini"
+#else
                                string dir = Path.GetDirectoryName 
(WebConfigurationSettings.MachineConfigPath);
                                string filepath = Path.Combine (dir, 
"browscap.ini");
                                if (!File.Exists (filepath)) {
@@ -189,7 +191,7 @@
                                        dir = Path.GetDirectoryName (dir);
                                        filepath = Path.Combine (dir, 
"browscap.ini");
                                }
-
+#endif
                                try {
                                        LoadFile (filepath);
                                } catch (Exception) { }
@@ -197,13 +199,38 @@
                                loaded = true;
                        }
                }
-
+#if TARGET_J2EE
+       private static TextReader GetJavaTextReader(string filename)
+       {
+               Stream s;
+               try
+               {
+                       java.lang.ClassLoader cl = (java.lang.ClassLoader)
+                                               
AppDomain.CurrentDomain.GetData("GH_ContextClassLoader");
+                       if (cl == null)
+                               return null;
+                       java.io.InputStream inputStream = 
cl.getResourceAsStream(filename);
+                       s = (Stream)vmw.common.IOUtils.getStream(inputStream);
+               }
+               catch (Exception e)
+               {
+                       return null;
+               }
+               return = new StreamReader (s);
+       }
+#endif
                static void LoadFile (string filename)
                {
+#if TARGET_J2EE
+                       TextReader input = GetJavaTextReader(filename);
+                       if(input == null)
+                               return;
+#else
                        if (!File.Exists (filename))
                                return;
 
                        TextReader input = new StreamReader (File.OpenRead 
(filename));
+#endif
                        string str;
                        Hashtable allhash = new Hashtable ();
                        int aux = 0;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to