DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=31831>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=31831

Otiose Code in ParameterParser

           Summary: Otiose Code in ParameterParser
           Product: Commons
           Version: Nightly Builds
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: File Upload
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The line "paramValue = null" is, I think, otiose in ParameterParser and
constitutes an operation that really does nothing except take up CPU space,
unless  the VM catches it, which I doubt, and ignores it.  Not sure if people
want to look at code this closely, but, if you do, then the code is:



  public Map parse(final char[] chars,
                   int offset,
                   int length,
                   char separator) {
    if (chars == null) {
      return new HashMap();
    }
    HashMap params = new HashMap();
    this.chars = chars;
    this.pos = offset;
    this.len = length;

    String paramName = null;
    String paramValue = null;
    while (hasChar()) {
      paramName = parseToken(new char[] { '=', separator });
      paramValue = null;
      if (hasChar() && (chars[pos] == '=')) {
        pos++; // skip '='
        paramValue = parseQuotedToken(new char[] { separator });
      }
      if (hasChar() && (chars[pos] == separator)) {
        pos++; // skip separator
      }
      if ((paramName != null) && (paramName.length() > 0)) {
        if (this.lowerCaseNames) {
          paramName = paramName.toLowerCase();
        }
        params.put(paramName, paramValue);
      }
    }
    return params;
  }

Michael McGrady

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to