struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mart...@apache.org
Subject cvs commit: jakarta-struts/src/share/org/apache/struts/validator ValidatorPlugIn.java
Date Sat, 07 Aug 2004 04:17:53 GMT
martinc     2004/08/06 21:17:53

  Modified:    src/share/org/apache/struts/taglib/html
                        JavascriptValidatorTag.java
               src/share/org/apache/struts/tiles/definition
                        ComponentDefinitionsFactoryWrapper.java
               src/share/org/apache/struts/validator ValidatorPlugIn.java
  Log:
  Fix a couple of things that FindBugs found:
   * Use Boolean.valueOf() instead of creating new instances.
   * Use StringBuffer instead of concatenating Strings in a loop.
  
  Revision  Changes    Path
  1.52      +24 -24    jakarta-struts/src/share/org/apache/struts/taglib/html/JavascriptValidatorTag.java
  
  Index: JavascriptValidatorTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/JavascriptValidatorTag.java,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- JavascriptValidatorTag.java	1 Jul 2004 00:40:24 -0000	1.51
  +++ JavascriptValidatorTag.java	7 Aug 2004 04:17:52 -0000	1.52
  @@ -200,18 +200,18 @@
           this.formName = formName;
       }
   
  -	/**
  -	 * @return Returns the jsFormName.
  -	 */
  -	public String getJsFormName() {
  -		return jsFormName;
  -	}
  -	/**
  -	 * @param jsFormName The jsFormName to set.
  -	 */
  -	public void setJsFormName(String jsFormName) {
  -		this.jsFormName = jsFormName;
  -	}
  +    /**
  +     * @return Returns the jsFormName.
  +     */
  +    public String getJsFormName() {
  +        return jsFormName;
  +    }
  +    /**
  +     * @param jsFormName The jsFormName to set.
  +     */
  +    public void setJsFormName(String jsFormName) {
  +        this.jsFormName = jsFormName;
  +    }
       /**
        * Gets the current page number of a multi-part form.
        * Only field validations with a matching page numer
  @@ -422,8 +422,8 @@
           String formName = form.getName();
           jsFormName = formName;
                   if(jsFormName.charAt(0) == '/') {
  -                	String mappingName = TagUtils.getInstance().getActionMappingName(jsFormName);
  -                	ActionMapping mapping = (ActionMapping) config.findActionConfig(mappingName);
  +                    String mappingName = TagUtils.getInstance().getActionMappingName(jsFormName);
  +                    ActionMapping mapping = (ActionMapping) config.findActionConfig(mappingName);
                       if (mapping == null) {
                           JspException e = new JspException(messages.getMessage("formTag.mapping",
mappingName));
                           pageContext.setAttribute(Globals.EXCEPTION_KEY, e, PageContext.REQUEST_SCOPE);
  @@ -589,21 +589,21 @@
        * @return JavaScript methods.
        */
       private String createMethods(List actions, boolean stopOnError) {
  -        String methods = null;
  +        StringBuffer methods = new StringBuffer();
           final String methodOperator = stopOnError ? " && " : " & ";
   
           Iterator iter = actions.iterator();
           while (iter.hasNext()) {
               ValidatorAction va = (ValidatorAction) iter.next();
   
  -            if (methods == null) {
  -                methods = va.getMethod() + "(form)";
  -            } else {
  -                methods += methodOperator + va.getMethod() + "(form)";
  +            if (methods.length() > 0) {
  +                methods.append(methodOperator);
               }
  +            methods.append(va.getMethod())
  +                   .append("(form)");
           }
   
  -        return methods;
  +        return methods.toString();
       }
   
       /**
  
  
  
  1.13      +4 -4      jakarta-struts/src/share/org/apache/struts/tiles/definition/ComponentDefinitionsFactoryWrapper.java
  
  Index: ComponentDefinitionsFactoryWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/definition/ComponentDefinitionsFactoryWrapper.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ComponentDefinitionsFactoryWrapper.java	14 Mar 2004 06:23:50 -0000	1.12
  +++ ComponentDefinitionsFactoryWrapper.java	7 Aug 2004 04:17:52 -0000	1.13
  @@ -207,7 +207,7 @@
   
           map.put(
               DefinitionsFactoryConfig.PARSER_VALIDATE_PARAMETER_NAME,
  -            new Boolean(config.getParserValidate()).toString());
  +            Boolean.valueOf(config.getParserValidate()).toString());
   
           if (!"org.apache.struts.tiles.xmlDefinition.I18nFactorySet"
               .equals(config.getFactoryClassname())) {
  
  
  
  1.26      +5 -5      jakarta-struts/src/share/org/apache/struts/validator/ValidatorPlugIn.java
  
  Index: ValidatorPlugIn.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/validator/ValidatorPlugIn.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- ValidatorPlugIn.java	3 Apr 2004 00:06:55 -0000	1.25
  +++ ValidatorPlugIn.java	7 Aug 2004 04:17:52 -0000	1.26
  @@ -167,7 +167,7 @@
                                                        resources);
   
               servlet.getServletContext().setAttribute(STOP_ON_ERROR_KEY + '.' + config.getPrefix(),
  -                                                     new Boolean(this.stopOnFirstError));
  +                                                     Boolean.valueOf(this.stopOnFirstError));
   
           } catch (Exception e) {
               log.error(e.getMessage(), e);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message