소스 검색

2007-11-03 Marek Habersack <[email protected]>

	* SimpleWebHandlerParser.cs: don't NRE on a null assembly passed
	to AddAssembly.
	AddAssemblyByName must check the return value of
	Assembly.LoadWithPartialName, as the method doesn't throw on
	missing assembly, it returns null instead.

svn path=/trunk/mcs/; revision=88761
Marek Habersack 18 년 전
부모
커밋
a299822de8
2개의 변경된 파일15개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 0
      mcs/class/System.Web/System.Web.UI/ChangeLog
  2. 9 1
      mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs

+ 6 - 0
mcs/class/System.Web/System.Web.UI/ChangeLog

@@ -1,5 +1,11 @@
 2007-11-03  Marek Habersack  <[email protected]>
 
+	* SimpleWebHandlerParser.cs: don't NRE on a null assembly passed
+	to AddAssembly.
+	AddAssemblyByName must check the return value of
+	Assembly.LoadWithPartialName, as the method doesn't throw on
+	missing assembly, it returns null instead.
+
 	* ClientScriptManager.cs: eventValidationArray is serialized in an
 	optimized fashion, so that its serialized form occupies only as
 	many slots as were actually used. It may result in that an array

+ 9 - 1
mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs

@@ -289,6 +289,9 @@ namespace System.Web.UI
 
 		internal virtual void AddAssembly (Assembly assembly, bool fullPath)
 		{
+			if (assembly == null)
+				throw new ArgumentNullException ("assembly");
+			
 			if (anames == null)
 				anames = new Hashtable ();
 
@@ -329,12 +332,17 @@ namespace System.Web.UI
 				return assembly;
 			}
 
+			Exception ex = null;
 			try {
 				assembly = Assembly.LoadWithPartialName (name);
 			} catch (Exception e) {
-				throw new ParseException (location, "Assembly " + name + " not found", e);
+				ex = null;
+				assembly = null;
 			}
 
+			if (assembly == null)
+				throw new ParseException (location, String.Format ("Assembly '{0}' not found", name), ex);
+			
 			AddAssembly (assembly, true);
 			return assembly;
 		}