in velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/LinkTool.java [725:757]
protected String combineQuery(String current, String add)
{
if (add == null || add.length() == 0)
{
return current;
}
if (add.startsWith("?"))
{
add = add.substring(1, add.length());
}
if (current == null || current.length() == 0)
{
return add;
}
if (current.endsWith(queryDelim))
{
current = current.substring(0, current.length() - queryDelim.length());
}
else if (current.endsWith("&"))
{
current = current.substring(0, current.length() - 1);
}
if (add.startsWith(queryDelim))
{
return current + add;
}
else if (add.startsWith("&"))
{
// drop the html delim in favor of the xhtml one
add = add.substring(1, add.length());
}
return current + queryDelim + add;
}