Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -332,9 +332,6 @@ namespace System.Web
lock (lockobj) {
if (loaded)
return;
#if TARGET_J2EE
string filepath = "browscap.ini";
#else
string dir = HttpRuntime.MachineConfigurationDirectory;
string filepath = Path.Combine (dir, "browscap.ini");
if (!File.Exists (filepath)) {
@@ -342,7 +339,6 @@ namespace System.Web
dir = Path.GetDirectoryName (dir);
filepath = Path.Combine (dir, "browscap.ini");
}
#endif
try {
LoadFile (filepath);
} catch (Exception) {}
@@ -351,46 +347,13 @@ namespace System.Web
}
}
#if TARGET_J2EE
static TextReader GetJavaTextReader(string filename)
{
try
{
java.lang.ClassLoader cl = (java.lang.ClassLoader)
AppDomain.CurrentDomain.GetData("GH_ContextClassLoader");
if (cl == null)
return null;
string custom = String.Concat("browscap/", filename);
java.io.InputStream inputStream = cl.getResourceAsStream(custom);
if (inputStream == null)
inputStream = cl.getResourceAsStream(filename);
if (inputStream == null)
return null;
return new StreamReader (new System.Web.J2EE.J2EEUtils.InputStreamWrapper (inputStream));
}
catch (Exception e)
{
return null;
}
}
#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
using (input) {
string str;
Hashtable allhash = new Hashtable (StringComparer.OrdinalIgnoreCase);