You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by ja...@apache.org on 2011/08/16 15:38:07 UTC

svn commit: r1158270 - /incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/controller/NewAccountController.java

Author: jasha
Date: Tue Aug 16 13:38:07 2011
New Revision: 1158270

URL: http://svn.apache.org/viewvc?rev=1158270&view=rev
Log:
RAVE-80 Remove resolved TODO's. Lower log level for non application critical situations.

Modified:
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/controller/NewAccountController.java

Modified: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/controller/NewAccountController.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/controller/NewAccountController.java?rev=1158270&r1=1158269&r2=1158270&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/controller/NewAccountController.java (original)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/controller/NewAccountController.java Tue Aug 16 13:38:07 2011
@@ -54,7 +54,6 @@ public class NewAccountController {
     @RequestMapping(value ="/newaccount.jsp")
 	 public void setUpForm(ModelMap model) {
 		  logger.debug("Initializing form");
-		  //TODO this should use view keys like other pages. (done)
 		  model.addAttribute(ModelKeys.NEW_USER,new NewUser());
 	 }
 
@@ -64,33 +63,31 @@ public class NewAccountController {
 		  model.addAttribute(ModelKeys.NEW_USER,newUser);
 		  
 		  newAccountValidator.validate(newUser,results);
-		  if(results.hasErrors()){
-			  logger.error("newaccount.jsp: shows validation errors");
-			  //TODO: change this to a viewname (done)
+		  if (results.hasErrors()){
+			  logger.info("newaccount.jsp: shows validation errors");
 			  return ViewNames.NEW_ACCOUNT;
 		  }
 
 		  //Now attempt to create the account.
 		  try {
 			    logger.debug("newaccount.jsp: passed form validation");
-			    newAccountService.createNewAccount(newUser.getUsername(),newUser.getPassword(),newUser.getPageLayout());
-			    //TODO: change this to a viewname (done)
+			    newAccountService.createNewAccount(newUser.getUsername(),newUser.getPassword(),
+                        newUser.getPageLayout());
 				return ViewNames.REDIRECT;
-		  }
-		  
-		  catch (org.springframework.dao.IncorrectResultSizeDataAccessException ex) {
+		  } catch (org.springframework.dao.IncorrectResultSizeDataAccessException ex) {
 				//This exception is thrown if the account already exists.
-				logger.error("Account creation failed: "+ex.getMessage());
+				logger.info("Account creation failed: ", ex);
 				results.reject("Account already exists","Unable to create account");
-				//TODO: change this to a viewname (done)
 				return ViewNames.NEW_ACCOUNT;
 				
-		  }
-		  //TODO need to handle more specific exceptions
-		  catch (Exception ex) {
-				logger.error("Account creation failed: "+ex.getMessage());
+		  } catch (Exception ex) {
+              //TODO need to handle more specific exceptions
+              if (logger.isDebugEnabled()) {
+                  logger.error("Account creation failed: ", ex);
+              } else {
+                  logger.error("Account creation failed: ", ex.getMessage());
+              }
 				results.reject("Unable to create account:"+ex.getMessage(),"Unable to create account");
-				//TODO: change this to a viewname (done)
 				return ViewNames.NEW_ACCOUNT;
 		  }