commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 36519] New: - Scaffold: bug in function ConvertUtils.addParams(String path, Map parameters)
Date Tue, 06 Sep 2005 13:09:26 GMT
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=36519>.
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=36519

           Summary: Scaffold: bug in function ConvertUtils.addParams(String
                    path, Map parameters)
           Product: Commons
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Sandbox
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: stefano.bertini@plangroup.it


I found a bug in function public static String addParams(String path, Map
parameters)
in class org.apache.commons.scaffold.text.ConvertUtils

When adding multiple parameters, the function doesn't insert the "&amp;" between
each parameter.

I modified in this way the function

public static String addParams(String path, Map parameters) {

    if (null==path) path = new String();

    if ((null==parameters) || (parameters.isEmpty())) return path;

    StringBuffer uri = new StringBuffer(path);
    boolean isQuery = (path.indexOf(QS_START)>=0);
    if (isQuery)
        uri.append(QS_DELIM);
    else
        uri.append(QS_START);

    Set entries = parameters.entrySet();
    for (Iterator i = entries.iterator(); i.hasNext(); ) {
        Entry e = (Entry) i.next();
        uri.append(e.getKey());
        uri.append(QS_SEP);
        uri.append(e.getValue());
        if (i.hasNext()) {         // *** PATCH ***
          uri.append(QS_DELIM);    // *** PATCH ***
        }                          // *** PATCH ***
    }
    return uri.toString();

}

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message