2003-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Wed, 30 Apr 2003 04:52:31 +0000 (04:52 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Wed, 30 Apr 2003 04:52:31 +0000 (04:52 -0000)
* HtmlizedException.cs: simplified to cope with the new interface.

* HttpApplicationFactory.cs: use the application file parser to get the
application Type.

* HttpException.cs: small changes. Needs some more work on
ParseExceptions.

svn path=/trunk/mcs/; revision=14139

mcs/class/System.Web/System.Web/ChangeLog
mcs/class/System.Web/System.Web/HtmlizedException.cs
mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
mcs/class/System.Web/System.Web/HttpException.cs

index 3607685fe3a0eee6be98c57559b2f2c86cd1db92..1d432afcd5bbd6ad196b3b8015871fe687798898 100644 (file)
@@ -1,3 +1,13 @@
+2003-04-30  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HtmlizedException.cs: simplified to cope with the new interface.
+
+       * HttpApplicationFactory.cs: use the application file parser to get the 
+       application Type.
+       
+       * HttpException.cs: small changes. Needs some more work on
+       ParseExceptions.
+       
 2003-03-25  Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * HttpRequest.cs: fixed Url property.
index ceb691f7702a6f0248080bbe6b7fc8bdbf1d7fcb..c9bbf83c84af296760a2853698ee1e173f796743 100644 (file)
@@ -33,40 +33,6 @@ namespace System.Web
                public abstract string Description { get; }
                public abstract string ErrorMessage { get; }
                public abstract string FileName { get; }
-               public abstract StringReader SourceError { get; }
-               public abstract int SourceErrorLine { get; }
-               public abstract TextReader SourceFile { get; }
-
-               public bool HaveSourceError {
-                       get { return SourceError != null; }
-               }
-
-               public bool HaveSourceFile {
-                       get { return SourceFile != null; }
-               }
-
-               internal static string GetErrorLines (TextReader reader, int line, out int errorLine)
-               {
-                       int firstLine = (line > 2) ? (line - 2) : line;
-                       int lastLine = (line >= 0) ? (firstLine + 2) : Int32.MaxValue;
-                       errorLine = (line > 2) ? line : 1;
-                       int current = 0;
-                       string s;
-
-                       while ((s = reader.ReadLine ()) != null && current != firstLine)
-                               current++;
-
-                       if (s == null)
-                               return "Cannot read error line.";
-
-                       StringBuilder builder = new StringBuilder ();
-                       do {
-                               builder.Append (s + '\n');
-                               current++;
-                       } while (current < lastLine && (s = reader.ReadLine ()) != null);
-
-                       return builder.ToString ();
-               }
        }
 }
 
index e64c0aab1fdda634e3b5b1b28d5d7728250b7d5d..0f5c373dad59253c5aa35efa752d618a4c19d018 100644 (file)
@@ -11,7 +11,7 @@ using System;
 using System.Collections;\r
 using System.IO;\r
 using System.Reflection;\r
-using System.Web;\r
+using System.Web.UI;\r
 using System.Web.Compilation;\r
 using System.Web.SessionState;\r
 \r
@@ -75,7 +75,7 @@ namespace System.Web {
                        if (File.Exists(_appFilename)) {\r
                                // Setup filemonitor for all filedepend also. CacheDependency?\r
 \r
-                               _appType = GlobalAsaxCompiler.CompileApplicationType (_appFilename, context);\r
+                               _appType = ApplicationFileParser.GetCompiledApplicationType (_appFilename, context);\r
                                if (_appType == null) {\r
                                        string msg = String.Format ("Error compiling application file ({0}).", _appFilename);\r
                                        throw new ApplicationException (msg);\r
@@ -322,5 +322,9 @@ namespace System.Web {
                {\r
                        custApplication = customApplication;\r
                }\r
+\r
+               internal Type AppType {\r
+                       get { return _appType; }\r
+               }\r
        }\r
 }\r
index 30e797f61b8b30cbc8c018cf4b11beab7ccb62a2..230daa7f5150481cf271e95fe599375d052a4aa9 100644 (file)
@@ -11,8 +11,8 @@
 using System;
 using System.IO;
 using System.Text;
-//using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
+using System.Web.Compilation;
 using System.Web.Util;
 
 namespace System.Web
@@ -102,7 +102,8 @@ namespace System.Web
 
                static string HtmlEncode (string s)
                {
-                       return HttpUtility.HtmlEncode (s);
+                       string res = HttpUtility.HtmlEncode (s);
+                       return res.Replace ("\n", "<br />");
                }
                
                string GetHtmlizedErrorMessage ()
@@ -119,6 +120,14 @@ namespace System.Web
                        builder.AppendFormat ("<b>Description: </b>{0}\n<p>\n", HtmlEncode (exc.Description));
                        builder.AppendFormat ("<b>Error message: </b>{0}\n<p>\n", HtmlEncode (exc.ErrorMessage));
 
+                       if (exc is ParseException)
+                               builder.Append ("<b>File name: </b>" + exc.FileName);
+                       else if (exc is CompilationException) {
+                               builder.Append ("<table summary=\"Source file\" width=\"100%\" bgcolor=\"#ffffc\">\n<tr><td>");
+                               FormatReader (builder, ((CompilationException) exc).File, 0);
+                               builder.Append ("</td></tr>\n</table>\n<p>\n");
+                       }
+                       /*
                        if (exc.HaveSourceError) {
                                builder.Append ("<b>Source Error: </b>\n<p>\n");
                                builder.Append ("<table summary=\"Source error\" width=\"100%\" bgcolor=\"#ffffc\">\n<tr><td>");
@@ -138,12 +147,17 @@ namespace System.Web
                                builder.Append ("</td></tr>\n</table>\n<p>\n");
                        }
                        
-                       
+                       */
                        builder.Append ("<hr>\n</body>\n</html>\n");
                        builder.AppendFormat ("<!--\n{0}\n-->\n", HtmlEncode (exc.ToString ()));
                        return builder.ToString ();
                }
 
+               static void FormatReader (StringBuilder builder, string text, int errorLine)
+               {
+                       FormatReader (builder, new StringReader (text), errorLine, true);
+               }
+               
                static void FormatReader (StringBuilder builder, TextReader reader, int errorLine)
                {
                        FormatReader (builder, reader, errorLine, true);