svn path=/trunk/mcs/; revision=47661
+2005-07-25 Eyal Alalouf <eyala@mainsoft.com>
+ * WebConfigurationSettings.cs: Fixed LoadFromFile to find web.config under
+ TARGET_J2EE (case sensitivity).
+
2005-07-25 Eyal Alalouf <eyala@mainsoft.com>
* WebConfigurationSettings.cs: TARGET_J2EE ifdef reorder for readability.
2005-07-25 Eyal Alalouf <eyala@mainsoft.com>
* WebConfigurationSettings.cs: TARGET_J2EE ifdef reorder for readability.
factories = new Hashtable ();
}
factories = new Hashtable ();
}
public bool LoadFromFile (string fileName)
{
this.fileName = fileName;
public bool LoadFromFile (string fileName)
{
this.fileName = fileName;
- if (fileName == null)
- return false;
- XmlTextReader reader = null;
- java.io.InputStream inputStream = null;
- try {
- IResourceLoader resLoader = (IResourceLoader)AppDomain.CurrentDomain.GetData("GH_ResourceLoader");
- if (resLoader == null)
- throw new HttpException("Unexpected exception. Resource loader not initialized under current domain");
- if (fileName.StartsWith(IAppDomainConfig.WAR_ROOT_SYMBOL))
- fileName = fileName.Substring(IAppDomainConfig.WAR_ROOT_SYMBOL.Length);
-
- inputStream = resLoader.getResourceAsStream(fileName);
-
- // patch for machine.config
- if (inputStream == null && fileName.EndsWith("machine.config"))
+ Stream fs = null;
+ if (fileName == null || !File.Exists (fileName)) {
+#if TARGET_J2EE
+ if (fileName != null && fileName.EndsWith("machine.config"))
{
if (fileName.StartsWith("/"))
fileName = fileName.Substring(1);
java.lang.ClassLoader cl = (java.lang.ClassLoader)AppDomain.CurrentDomain.GetData("GH_ContextClassLoader");
{
if (fileName.StartsWith("/"))
fileName = fileName.Substring(1);
java.lang.ClassLoader cl = (java.lang.ClassLoader)AppDomain.CurrentDomain.GetData("GH_ContextClassLoader");
- if (cl != null)
- inputStream = cl.getResourceAsStream(fileName);
+ if (cl == null)
+ return false;
+ java.io.InputStream inputStream = cl.getResourceAsStream(fileName);
+ fs = (Stream)IOUtils.getStream(inputStream);
- if (inputStream == null)
-
- Stream fs = (Stream)IOUtils.getStream(inputStream);
- reader = new XmlTextReader (fs);
- InitRead (reader);
- ReadConfig (reader, false);
- }
- catch (ConfigurationException) { throw; }
- catch (Exception e)
- {
- throw new ConfigurationException ("Error reading " + fileName, e);
- }
- finally
- {
- if (reader != null)
- reader.Close();
- if (inputStream != null)
- inputStream.close();
- return true;
- }
-#else
- public bool LoadFromFile (string fileName)
- {
- this.fileName = fileName;
- if (fileName == null || !File.Exists (fileName))
- return false;
-
XmlTextReader reader = null;
try {
XmlTextReader reader = null;
try {
- FileStream fs = new FileStream (fileName, FileMode.Open, FileAccess.Read);
+ if (fs == null)
+ fs = new FileStream (fileName, FileMode.Open, FileAccess.Read);
reader = new XmlTextReader (fs);
InitRead (reader);
ReadConfig (reader, false);
reader = new XmlTextReader (fs);
InitRead (reader);
ReadConfig (reader, false);
public void LoadFromReader (XmlTextReader reader, string fakeFileName, bool isLocation)
{
public void LoadFromReader (XmlTextReader reader, string fakeFileName, bool isLocation)
{