Browse Source

TARGET_JVM: facultatively throw exception when loading profiles

svn path=/trunk/mcs/; revision=70482
Igor Zelmanovich 19 years ago
parent
commit
f32e4629a7

+ 5 - 0
mcs/class/System.Web/System.Web.J2EE/ChangeLog

@@ -1,3 +1,8 @@
+2007-01-04  Igor Zelmanovich <[email protected]>
+
+	* PageMapper.cs: refactoring: 
+	GetCachedType, GetObjectType - added overloads
+
 2006-08-20  Vladimir Krasnov <[email protected]>
 
 	* BaseHttpServlet.cs: merged TLS fixes, workaround for thread problem

+ 10 - 3
mcs/class/System.Web/System.Web.J2EE/PageMapper.cs

@@ -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;

+ 3 - 3
mcs/class/System.Web/System.Web.Profile/ProfileParser.jvm.cs

@@ -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 ('/');
+				profileGroupType = PageMapper.GetObjectType (resolvedUrl, false);
 			}
 			return profileGroupType;
 		}