You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by am...@apache.org on 2002/06/21 00:53:16 UTC

cvs commit: jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources DataSourceForm.java

amyroh      2002/06/20 15:53:16

  Modified:    webapps/admin/WEB-INF/classes/org/apache/webapp/admin/context
                        ContextForm.java SaveContextAction.java
               webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources
                        DataSourceForm.java
  Log:
  Change validation code for data source password, context path and work directory,
  and session manager identifier so that it can be null to allow default settings.
  
  Revision  Changes    Path
  1.8       +14 -13    jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/context/ContextForm.java
  
  Index: ContextForm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/context/ContextForm.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ContextForm.java	21 May 2002 19:47:10 -0000	1.7
  +++ ContextForm.java	20 Jun 2002 22:53:15 -0000	1.8
  @@ -769,14 +769,15 @@
                   errors.add("docBase", new ActionError("error.docBase.required"));
               }
               
  +            // if path is empty, it's root context
               // validate context starting with "/" only at the time of context creation.
  -            if ("Create".equalsIgnoreCase(adminAction) && !path.startsWith("/")) {
  -                errors.add("path", new ActionError("error.path.prefix"));                
  -            }
  +            //if ("Create".equalsIgnoreCase(adminAction) && !path.startsWith("/")) {
  +            //    errors.add("path", new ActionError("error.path.prefix"));                
  +            //}
                           
  -            if ((workDir == null) || (workDir.length() < 1)) {
  -                errors.add("workDir", new ActionError("error.workDir.required"));
  -            }
  +            //if ((workDir == null) || (workDir.length() < 1)) {
  +            //    errors.add("workDir", new ActionError("error.workDir.required"));
  +            //}
               
               // loader properties
               // FIXME-- verify if these ranges are ok.
  @@ -786,9 +787,9 @@
               numberCheck("mgrCheckInterval",  mgrCheckInterval, true, 0, 10000);
               numberCheck("mgrMaxSessions",  mgrMaxSessions, false, -1, 100);
               
  -            if ((mgrSessionIDInit == null) || (mgrSessionIDInit.length() < 1)) {
  -                errors.add("mgrSessionIDInit", new ActionError("error.mgrSessionIDInit.required"));
  -            }
  +            //if ((mgrSessionIDInit == null) || (mgrSessionIDInit.length() < 1)) {
  +            //    errors.add("mgrSessionIDInit", new ActionError("error.mgrSessionIDInit.required"));
  +            //}
           }
           
           return errors;
  
  
  
  1.4       +16 -18    jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/context/SaveContextAction.java
  
  Index: SaveContextAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/context/SaveContextAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SaveContextAction.java	9 May 2002 01:07:30 -0000	1.3
  +++ SaveContextAction.java	20 Jun 2002 22:53:15 -0000	1.4
  @@ -185,7 +185,10 @@
           String cObjectName = cform.getObjectName();
           String lObjectName = cform.getLoaderObjectName();
           String mObjectName = cform.getManagerObjectName();
  -        
  +        if ((cform.getPath() == null) || (cform.getPath().length()<1)) {
  +            cform.setPath("/");
  +        }
  +       
           // Perform a "Create Context" transaction (if requested)
           if ("Create".equals(adminAction)) {
   
  @@ -318,13 +321,11 @@
               
               attribute = "workDir";
               String workDir = "";
  -            try {
  -                workDir = cform.getWorkDir();
  -            } catch (Throwable t) {
  -                workDir = "";
  -            }
  -            mBServer.setAttribute(coname,
  +            workDir = cform.getWorkDir();
  +            if ((workDir!=null) && (workDir.length()>=1)) {
  +                mBServer.setAttribute(coname,
                                     new Attribute("workDir", workDir));
  +            }
    
               attribute = "cookies";
               String cookies = "false";
  @@ -407,14 +408,11 @@
   
               // Manager properties            
               attribute = "entropy";
  -            String entropy = "";
  -            try {
  -                entropy = cform.getMgrSessionIDInit();
  -            } catch (Throwable t) {
  -                entropy = "";
  -            }
  -            mBServer.setAttribute(moname,
  +            String entropy = cform.getMgrSessionIDInit();
  +            if ((entropy!=null) && (entropy.length()>=1)) {
  +                mBServer.setAttribute(moname,
                                     new Attribute("entropy",entropy));
  +            }
               
               attribute = "debug";
               try {
  
  
  
  1.5       +9 -8      jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources/DataSourceForm.java
  
  Index: DataSourceForm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/resources/DataSourceForm.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DataSourceForm.java	14 Jun 2002 13:29:29 -0000	1.4
  +++ DataSourceForm.java	20 Jun 2002 22:53:16 -0000	1.5
  @@ -368,11 +368,12 @@
                              new ActionError("users.error.username.required"));
               }
               
  +            // commented out password can be an empty string
               // password is a required field
  -            if ((password == null) || (password.length() < 1)) {
  -                errors.add("password",
  -                           new ActionError("error.userPassword.required"));
  -            }
  +            //if ((password == null) || (password.length() < 1)) {
  +            //    errors.add("password",
  +            //               new ActionError("error.userPassword.required"));
  +            //
               
               // FIX ME -- need to do a range check
               numberCheck("active", active , false, 0, 10000);
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>