TARGET_JVM: facultatively throw exception when loading profiles
authorIgor Zelmanovich <igorz@mono-cvs.ximian.com>
Thu, 4 Jan 2007 15:13:36 +0000 (15:13 -0000)
committerIgor Zelmanovich <igorz@mono-cvs.ximian.com>
Thu, 4 Jan 2007 15:13:36 +0000 (15:13 -0000)
svn path=/trunk/mcs/; revision=70482

mcs/class/System.Web/System.Web.J2EE/ChangeLog
mcs/class/System.Web/System.Web.J2EE/PageMapper.cs
mcs/class/System.Web/System.Web.Profile/ProfileParser.jvm.cs

index 96f3c62037ee865de2c0d7b1ce1be4cebb25d7b5..cfd62f085ad1c16b61600d9206d84a9b2fcf81e1 100644 (file)
@@ -1,3 +1,8 @@
+2007-01-04  Igor Zelmanovich <igorz@mainsoft.com>\r
+\r
+       * PageMapper.cs: refactoring: \r
+       GetCachedType, GetObjectType - added overloads\r
+\r
 2006-08-20  Vladimir Krasnov <vladimirk@mainsoft.com>\r
 \r
        * BaseHttpServlet.cs: merged TLS fixes, workaround for thread problem\r
index c8bbc45ccfb8920f4232a52bd61d8dd3801635f0..5a2d2ee5cc2739962a350b885e114439f60d7d9c 100644 (file)
@@ -145,7 +145,11 @@ namespace System.Web.J2EE
 
                public static Type GetObjectType(string url)
                {
-                       return GetCachedType(NormalizeName(url));
+                       return GetCachedType(NormalizeName(url), true);
+               }
+
+               public static Type GetObjectType (string url, bool throwException) {
+                       return GetCachedType (NormalizeName (url), throwException);
                }
 
                public static Assembly GetObjectAssembly(string url)
@@ -170,11 +174,14 @@ namespace System.Web.J2EE
 
                        return t;
                }
-               private static Type GetCachedType(string url)
+               private static Type GetCachedType (string url) {
+                       return GetCachedType (url, true);
+               }
+               private static Type GetCachedType (string url, bool throwException)
                {
                        ICachedXmlDoc doc = PageMapper.GetAssembliesCachedDocument();                                           
                        Type t = doc.GetType(url);
-                       if (t == null)
+                       if (t == null && throwException)
                                throw new HttpException(404,"The requested resource (" + url + ") is not available.");
 
                        return t;
index e233c305548b90a263a14339b3ccf027dda3fd7e..4f27b528dc6caa84e5467958b1374e94e4543a5a 100644 (file)
@@ -50,7 +50,7 @@ namespace System.Web.Profile
                                //PageMapper call
                                string virtualPath = "~/App_Code/ProfileCommon";
                                string resolvedUrl = System.Web.Util.UrlUtils.ResolveVirtualPathFromAppAbsolute (virtualPath).TrimEnd ('/');
-                               profileBaseType = PageMapper.GetObjectType (resolvedUrl);
+                               profileBaseType = PageMapper.GetObjectType (resolvedUrl, false);
                        }
                        return profileBaseType;
                }
@@ -61,8 +61,8 @@ namespace System.Web.Profile
                        if (profileGroupType == null) {
                                //PageMapper call
                                string virtualPath = "~/App_Code/ProfileGroup" + groupName;
-                               string resolvedUrl = System.Web.Util.UrlUtils.ResolveVirtualPathFromAppAbsolute (virtualPath).TrimEnd ('/');
-                               profileGroupType = PageMapper.GetObjectType (resolvedUrl);
+                               string resolvedUrl = System.Web.Util.UrlUtils.ResolveVirtualPathFromAppAbsolute (virtualPath).TrimEnd ('/');\r
+                               profileGroupType = PageMapper.GetObjectType (resolvedUrl, false);
                        }
                        return profileGroupType;
                }