geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xiam...@apache.org
Subject svn commit: r1038647 - in /geronimo/daytrader/branches/2.2/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web: TradeAppServlet.java TradeServletAction.java
Date Wed, 24 Nov 2010 15:30:56 GMT
Author: xiaming
Date: Wed Nov 24 15:30:55 2010
New Revision: 1038647

URL: http://svn.apache.org/viewvc?rev=1038647&view=rev
Log:
DAYTRADER-51 fix NPE in 2.2 branch

Modified:
    geronimo/daytrader/branches/2.2/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeAppServlet.java
    geronimo/daytrader/branches/2.2/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeServletAction.java

Modified: geronimo/daytrader/branches/2.2/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeAppServlet.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/branches/2.2/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeAppServlet.java?rev=1038647&r1=1038646&r2=1038647&view=diff
==============================================================================
--- geronimo/daytrader/branches/2.2/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeAppServlet.java
(original)
+++ geronimo/daytrader/branches/2.2/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeAppServlet.java
Wed Nov 24 15:30:55 2010
@@ -128,7 +128,11 @@ public class TradeAppServlet extends Htt
             userID = req.getParameter("uid");
             String passwd = req.getParameter("passwd");
             String inScenario = req.getParameter("inScenario");
-            tsAction.doLogin(ctx, req, resp, userID, passwd);
+            try {
+            	tsAction.doLogin(ctx, req, resp, userID, passwd);
+            } catch (ServletException se) {
+            	tsAction.doWelcome(ctx, req, resp, se.getMessage());
+            }
             return;
         } else if (action.equals("register")) {
             userID = req.getParameter("user id");

Modified: geronimo/daytrader/branches/2.2/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeServletAction.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/branches/2.2/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeServletAction.java?rev=1038647&r1=1038646&r2=1038647&view=diff
==============================================================================
--- geronimo/daytrader/branches/2.2/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeServletAction.java
(original)
+++ geronimo/daytrader/branches/2.2/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeServletAction.java
Wed Nov 24 15:30:55 2010
@@ -409,13 +409,14 @@ public class TradeServletAction {
                 return;
             } else {
                 req.setAttribute("results", results
-                        + "\nCould not find account for + " + userID);
+                        + "\nCould not find account for user=" + userID);
                 // log the exception with an error level of 3 which means,
                 // handled exception but would invalidate a automation run
                 Log.log(
                                 "TradeServletAction.doLogin(...)",
                                 "Error finding account for user " + userID + "",
                                 "user entered a bad username or the database is not populated");
+                throw new NullPointerException("User does not exist or password is incorrect!");
             }
         } catch (java.lang.IllegalArgumentException e) { // this is a user
                                                             // error so I will
@@ -434,8 +435,8 @@ public class TradeServletAction {
         } catch (Exception e) {
             // log the exception with error page
             throw new ServletException("TradeServletAction.doLogin(...)"
-                    + "Exception logging in user " + userID + "with password"
-                    + passwd, e);
+                    + "Exception logging in user=" + userID + " with password="
+                    + passwd + "; " + e.getMessage(), e);
         }
 
         requestDispatch(ctx, req, resp, userID, TradeConfig



Mime
View raw message