[mapguide-commits] r4387 - in trunk/MgDev/Web/src: mapviewerjava mapviewernet mapviewerphp

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Dec 7 22:28:29 EST 2009


Author: christinebao
Date: 2009-12-07 22:28:29 -0500 (Mon, 07 Dec 2009)
New Revision: 4387

Modified:
   trunk/MgDev/Web/src/mapviewerjava/ajaxviewerabout.jsp
   trunk/MgDev/Web/src/mapviewerjava/common.jsp
   trunk/MgDev/Web/src/mapviewerjava/formframe.jsp
   trunk/MgDev/Web/src/mapviewerjava/gettingstarted.jsp
   trunk/MgDev/Web/src/mapviewerjava/legend.jsp
   trunk/MgDev/Web/src/mapviewerjava/legendctrl.jsp
   trunk/MgDev/Web/src/mapviewerjava/legendui.jsp
   trunk/MgDev/Web/src/mapviewerjava/mainframe.jsp
   trunk/MgDev/Web/src/mapviewerjava/printablepage.jsp
   trunk/MgDev/Web/src/mapviewerjava/printablepageui.jsp
   trunk/MgDev/Web/src/mapviewerjava/propertyctrl.jsp
   trunk/MgDev/Web/src/mapviewernet/common.aspx
   trunk/MgDev/Web/src/mapviewernet/formframe.aspx
   trunk/MgDev/Web/src/mapviewernet/gettingstarted.aspx
   trunk/MgDev/Web/src/mapviewernet/legend.aspx
   trunk/MgDev/Web/src/mapviewernet/legendctrl.aspx
   trunk/MgDev/Web/src/mapviewernet/legendui.aspx
   trunk/MgDev/Web/src/mapviewernet/mainframe.aspx
   trunk/MgDev/Web/src/mapviewernet/mapframe.aspx
   trunk/MgDev/Web/src/mapviewernet/printablepage.aspx
   trunk/MgDev/Web/src/mapviewernet/printablepageui.aspx
   trunk/MgDev/Web/src/mapviewerphp/common.php
   trunk/MgDev/Web/src/mapviewerphp/createlayer.php
   trunk/MgDev/Web/src/mapviewerphp/gettingstarted.php
   trunk/MgDev/Web/src/mapviewerphp/legend.php
   trunk/MgDev/Web/src/mapviewerphp/mainframe.php
   trunk/MgDev/Web/src/mapviewerphp/mapframe.php
Log:
Fix ticket https://trac.osgeo.org/mapguide/ticket/1187
"\n" displayed in Browser when error happened.

Modified: trunk/MgDev/Web/src/mapviewerjava/ajaxviewerabout.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/ajaxviewerabout.jsp	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewerjava/ajaxviewerabout.jsp	2009-12-08 03:28:29 UTC (rev 4387)
@@ -79,7 +79,7 @@
 }
 catch(Exception ne)
 {
-    String msg = ne.getLocalizedMessage();
+    String msg = EscapeForHtml(ne.getLocalizedMessage());
     writer = response.getWriter();
     writer.write(msg);
     response.setContentLength(msg.length());

Modified: trunk/MgDev/Web/src/mapviewerjava/common.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/common.jsp	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewerjava/common.jsp	2009-12-08 03:28:29 UTC (rev 4387)
@@ -165,9 +165,9 @@
 {
     str = str.replaceAll("'", "'");
     str = str.replaceAll("\"", """);
-    str = str.replaceAll("\n", " ");
     str = str.replaceAll("<", "&lt;");
     str = str.replaceAll(">", "&gt;");
+    str = str.replaceAll("\\\\n", "<br>");
     return str;
 }
 

Modified: trunk/MgDev/Web/src/mapviewerjava/formframe.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/formframe.jsp	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewerjava/formframe.jsp	2009-12-08 03:28:29 UTC (rev 4387)
@@ -34,7 +34,7 @@
 }
 catch(Exception ne)
 {
-    String msg = ne.getLocalizedMessage();
+    String msg = EscapeForHtml(ne.getLocalizedMessage());
     writer = response.getWriter();
     writer.write(msg);
     response.setContentLength(msg.length());

Modified: trunk/MgDev/Web/src/mapviewerjava/gettingstarted.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/gettingstarted.jsp	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewerjava/gettingstarted.jsp	2009-12-08 03:28:29 UTC (rev 4387)
@@ -80,10 +80,12 @@
             outStream.write(fixedupHtml);
     }
     catch(MgException mge) {
-        outStream.write(mge.GetDetails());
+        String errorMsg = EscapeForHtml(mge.GetDetails());
+        outStream.write(errorMsg);
     }
     catch(Exception e) {
-        outStream.write(e.getMessage());
+        String errorMsg = EscapeForHtml(e.getMessage());
+        outStream.write(errorMsg);
     }
 
 %>

Modified: trunk/MgDev/Web/src/mapviewerjava/legend.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/legend.jsp	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewerjava/legend.jsp	2009-12-08 03:28:29 UTC (rev 4387)
@@ -134,14 +134,14 @@
 }
 catch(MgException e)
 {
-    String details = e.GetDetails();
+    String details = EscapeForHtml(e.GetDetails());
     writer = response.getWriter();
     writer.write(details);
     response.setContentLength(details.length());
 }
 catch(Exception ne)
 {
-    String msg = ne.getLocalizedMessage();
+    String msg = EscapeForHtml(ne.getLocalizedMessage());
     writer = response.getWriter();
     writer.write(msg);
     response.setContentLength(msg.length());

Modified: trunk/MgDev/Web/src/mapviewerjava/legendctrl.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/legendctrl.jsp	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewerjava/legendctrl.jsp	2009-12-08 03:28:29 UTC (rev 4387)
@@ -58,7 +58,7 @@
 }
 catch(Exception ne)
 {
-    String msg = ne.getLocalizedMessage();
+    String msg = EscapeForHtml(ne.getLocalizedMessage());
     writer = response.getWriter();
     writer.write(msg);
     response.setContentLength(msg.length());

Modified: trunk/MgDev/Web/src/mapviewerjava/legendui.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/legendui.jsp	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewerjava/legendui.jsp	2009-12-08 03:28:29 UTC (rev 4387)
@@ -42,7 +42,7 @@
 }
 catch(Exception ne)
 {
-    String msg = ne.getLocalizedMessage();
+    String msg = EscapeForHtml(ne.getLocalizedMessage());
     writer = response.getWriter();
     writer.write(msg);
     response.setContentLength(msg.length());

Modified: trunk/MgDev/Web/src/mapviewerjava/mainframe.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/mainframe.jsp	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewerjava/mainframe.jsp	2009-12-08 03:28:29 UTC (rev 4387)
@@ -538,13 +538,13 @@
 }
 catch(MgException e)
 {
-    String msg = e.GetMessage();
+    String msg = EscapeForHtml(e.GetMessage());
     response.getWriter().write(msg);
     response.setContentLength(msg.length());
 }
 catch(Exception ne)
 {
-    String msg = ne.getLocalizedMessage();
+    String msg = EscapeForHtml(ne.getLocalizedMessage());
     response.getWriter().write(msg);
     response.setContentLength(msg.length());
 }

Modified: trunk/MgDev/Web/src/mapviewerjava/printablepage.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/printablepage.jsp	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewerjava/printablepage.jsp	2009-12-08 03:28:29 UTC (rev 4387)
@@ -84,7 +84,7 @@
 }
 catch(Exception ne)
 {
-    String msg = ne.getLocalizedMessage();
+    String msg = EscapeForHtml(ne.getLocalizedMessage());
     writer = response.getWriter();
     writer.write(msg);
     response.setContentLength(msg.length());

Modified: trunk/MgDev/Web/src/mapviewerjava/printablepageui.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/printablepageui.jsp	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewerjava/printablepageui.jsp	2009-12-08 03:28:29 UTC (rev 4387)
@@ -65,7 +65,7 @@
 }
 catch(Exception ne)
 {
-    String msg = ne.getLocalizedMessage();
+    String msg = EscapeForHtml(ne.getLocalizedMessage());
     writer = response.getWriter();
     writer.write(msg);
     response.setContentLength(msg.length());

Modified: trunk/MgDev/Web/src/mapviewerjava/propertyctrl.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/propertyctrl.jsp	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewerjava/propertyctrl.jsp	2009-12-08 03:28:29 UTC (rev 4387)
@@ -45,7 +45,7 @@
 }
 catch(Exception ne)
 {
-    String msg = ne.getLocalizedMessage();
+    String msg = EscapeForHtml(ne.getLocalizedMessage());
     writer = response.getWriter();
     writer.write(msg);
     response.setContentLength(msg.length());

Modified: trunk/MgDev/Web/src/mapviewernet/common.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/common.aspx	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewernet/common.aspx	2009-12-08 03:28:29 UTC (rev 4387)
@@ -159,9 +159,9 @@
 {
     str = str.Replace("'", "&#39;");
     str = str.Replace("\"", "&quot;");
-    str = str.Replace("\n", " ");
     str = str.Replace("<", "&lt;");
     str = str.Replace(">", "&gt;");
+    str = str.Replace("\\n", "<br>");
     return str;
 }
 

Modified: trunk/MgDev/Web/src/mapviewernet/formframe.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/formframe.aspx	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewernet/formframe.aspx	2009-12-08 03:28:29 UTC (rev 4387)
@@ -36,6 +36,7 @@
     }
     catch(Exception ne)
     {
-        Response.Write(ne.Message);
+        String errorMsg = EscapeForHtml(ne.Message);
+        Response.Write(errorMsg);
     }
 %>

Modified: trunk/MgDev/Web/src/mapviewernet/gettingstarted.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/gettingstarted.aspx	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewernet/gettingstarted.aspx	2009-12-08 03:28:29 UTC (rev 4387)
@@ -80,7 +80,8 @@
             Response.Write(fixedupHtml);
     }
     catch(MgException mge) {
-        Response.Write(mge.GetDetails());
+        String errorMsg = EscapeForHtml(mge.GetDetails());
+        Response.Write(errorMsg);
     }
     catch(Exception e) {
     }

Modified: trunk/MgDev/Web/src/mapviewernet/legend.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/legend.aspx	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewernet/legend.aspx	2009-12-08 03:28:29 UTC (rev 4387)
@@ -129,9 +129,8 @@
     }
     catch(MgException mge)
     {
-        Response.Write(mge.GetMessage());
-        Response.Write("<br>");
-        Response.Write(mge.GetDetails());
+        String errorMsg = EscapeForHtml(mge.GetDetails());
+        Response.Write(errorMsg);
     }
 
 %>

Modified: trunk/MgDev/Web/src/mapviewernet/legendctrl.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/legendctrl.aspx	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewernet/legendctrl.aspx	2009-12-08 03:28:29 UTC (rev 4387)
@@ -55,7 +55,8 @@
     }
     catch(Exception ne)
     {
-        Response.Write(ne.Message);
+        String errorMsg = EscapeForHtml(ne.Message);
+        Response.Write(errorMsg);
     }
 %>
 

Modified: trunk/MgDev/Web/src/mapviewernet/legendui.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/legendui.aspx	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewernet/legendui.aspx	2009-12-08 03:28:29 UTC (rev 4387)
@@ -41,7 +41,8 @@
     }
     catch(Exception ne)
     {
-        Response.Write(ne.Message);
+        String errorMsg = EscapeForHtml(ne.Message);
+        Response.Write(errorMsg);
     }
 %>
 

Modified: trunk/MgDev/Web/src/mapviewernet/mainframe.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/mainframe.aspx	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewernet/mainframe.aspx	2009-12-08 03:28:29 UTC (rev 4387)
@@ -537,13 +537,13 @@
     }
     catch (MgException e)
     {
-        Response.Write(e.GetMessage());
-        Response.Write("<br>");
-        Response.Write(e.GetDetails());
+        String errorMsg = EscapeForHtml(e.GetDetails());
+        Response.Write(errorMsg);
     }
     catch (Exception ne)
     {
-        Response.Write(ne.Message);
+        String errorMsg = EscapeForHtml(ne.Message);
+        Response.Write(errorMsg);
     }
 %>
 

Modified: trunk/MgDev/Web/src/mapviewernet/mapframe.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/mapframe.aspx	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewernet/mapframe.aspx	2009-12-08 03:28:29 UTC (rev 4387)
@@ -190,9 +190,8 @@
         }
         catch(MgException mge)
         {
-            Response.Write(mge.GetMessage());
-            Response.Write("<br>");
-            Response.Write(mge.GetDetails());
+            String errorMsg = EscapeForHtml(mge.GetDetails());
+            Response.Write(errorMsg);
         }
    }
 

Modified: trunk/MgDev/Web/src/mapviewernet/printablepage.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/printablepage.aspx	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewernet/printablepage.aspx	2009-12-08 03:28:29 UTC (rev 4387)
@@ -71,7 +71,8 @@
     }
     catch(Exception ne)
     {
-        Response.Write(ne.Message);
+        String errorMsg = EscapeForHtml(ne.Message);
+        Response.Write(errorMsg);
     }
 %>
 

Modified: trunk/MgDev/Web/src/mapviewernet/printablepageui.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/printablepageui.aspx	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewernet/printablepageui.aspx	2009-12-08 03:28:29 UTC (rev 4387)
@@ -63,7 +63,8 @@
     }
     catch(Exception ne)
     {
-        Response.Write(ne.Message);
+        String errorMsg = EscapeForHtml(ne.Message);
+        Response.Write(errorMsg);
     }
 %>
 

Modified: trunk/MgDev/Web/src/mapviewerphp/common.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/common.php	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewerphp/common.php	2009-12-08 03:28:29 UTC (rev 4387)
@@ -107,8 +107,8 @@
 
 function EscapeForHtml($str)
 {
-    $org = array("'", "\"", "\n", "<", ">");
-    $repl = array("&#39;", "&quot;", " ", "&lt;", "&gt;" );
+    $org = array("'", "\"", "<", ">", '\n');
+    $repl = array("&#39;", "&quot;", "&lt;", "&gt;", "<br>");
     return str_replace($org, $repl, $str);
 }
 

Modified: trunk/MgDev/Web/src/mapviewerphp/createlayer.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/createlayer.php	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewerphp/createlayer.php	2009-12-08 03:28:29 UTC (rev 4387)
@@ -79,6 +79,7 @@
 }
 catch (MgException $e)
 {
-    echo $e->GetMessage();
+    $errorMsg = EscapeForHtml($e->GetMessage());
+    echo $errorMsg;
 }
 ?>

Modified: trunk/MgDev/Web/src/mapviewerphp/gettingstarted.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/gettingstarted.php	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewerphp/gettingstarted.php	2009-12-08 03:28:29 UTC (rev 4387)
@@ -81,7 +81,8 @@
     }
     catch(MgException $e)
     {
-        echo $e->GetDetails();
+        $errorMsg = EscapeForHtml($e->GetDetails());
+        echo $errorMsg;
         return;
     }
 

Modified: trunk/MgDev/Web/src/mapviewerphp/legend.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/legend.php	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewerphp/legend.php	2009-12-08 03:28:29 UTC (rev 4387)
@@ -105,7 +105,9 @@
     }
     catch(MgException $e)
     {
-        echo $e->GetMessage() . "<p>" . $e->GetStackTrace();
+        $errorMsg = EscapeForHtml($e->GetMessage());
+        $traceMsg = EscapeForHtml($e->GetStackTrace());
+        echo $errorMsg . "<p>" . $traceMsg;
         return;
     }
     catch(Exception $ne)

Modified: trunk/MgDev/Web/src/mapviewerphp/mainframe.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/mainframe.php	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewerphp/mainframe.php	2009-12-08 03:28:29 UTC (rev 4387)
@@ -100,12 +100,12 @@
         catch(MgException $e)
         {
             $shortError = $e->GetMessage();
-            $longError = $e->GetDetails();
+            $longErrorMsg = EscapeForHtml($e->GetDetails());
             header("HTTP/1.1 559 ");
             header('Content-Type: text/html; charset=utf-8');
             header("Status: 559 {$shortError}");
             echo "<html>\n<body>\n";
-            echo "<h2>{$shortError}</h2>\n{$longError}";
+            echo $longErrorMsg;
             echo "</body>\n</html>\n";
             return;
         }
@@ -526,17 +526,18 @@
         // in order to give a nice custom error message, it looks as
         // if we shortcut things by using a 200 status.
         $shortError = $e->GetMessage();
-        $longError = $e->GetDetails();
+        $longErrorMsg = EscapeForHtml($e->GetDetails());
         header("HTTP/1.1 200 ");
         header('Content-Type: text/html; charset=utf-8');
         header("Status: 200 {$shortError}");
         echo "<html>\n<body>\n";
-        echo "<h2>{$shortError}</h2>\n{$longError}";
+        echo $longErrorMsg;
         echo "</body>\n</html>\n";
     }
     catch(Exception $ne)
     {
-        echo $ne->GetMessage();
+        $errorMsg = EscapeForHtml($ne->GetMessage());
+        echo $errorMsg;
     }
 }
 

Modified: trunk/MgDev/Web/src/mapviewerphp/mapframe.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/mapframe.php	2009-12-08 00:27:39 UTC (rev 4386)
+++ trunk/MgDev/Web/src/mapviewerphp/mapframe.php	2009-12-08 03:28:29 UTC (rev 4387)
@@ -157,7 +157,8 @@
     }
     catch(MgException $e)
     {
-        echo $e->GetDetails();
+        $errorMsg = EscapeForHtml($e->GetDetails());
+        echo $errorMsg;
     }
 }
 



More information about the mapguide-commits mailing list