Apply to h3

Fix for [HER-1225] HtmlFormCredential.java may create non-wellformed URLs
* HtmlFormCredential.java
    only insert '&' if previous query-string was non-empty
This commit is contained in:
gojomo
2009-05-14 20:32:42 +00:00
parent 9994edb170
commit e9622784f6
@@ -31,6 +31,7 @@ import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.URIException;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.lang.StringUtils;
import org.archive.modules.ProcessorURI;
import org.archive.net.UURI;
import org.archive.net.UURIFactory;
@@ -167,8 +168,11 @@ public class HtmlFormCredential extends Credential {
String currentQuery = hmb.getQueryString();
hmb.setQueryString(data);
String newQuery = hmb.getQueryString();
hmb.setQueryString(((currentQuery != null)? currentQuery: "") +
"&" + newQuery);
hmb.setQueryString(
((StringUtils.isNotEmpty(currentQuery))
? currentQuery + "&"
: "")
+ newQuery);
result = true;
} else {
logger.severe("Unknown method type: " + method);