From: <svn...@os...> - 2010-03-29 13:50:35
|
Author: groldan Date: 2010-03-29 09:50:29 -0400 (Mon, 29 Mar 2010) New Revision: 35133 Modified: trunk/modules/unsupported/wfs/src/main/java/org/geotools/data/wfs/protocol/http/AbstractHttpProtocol.java Log: GEOT-2962 Modified: trunk/modules/unsupported/wfs/src/main/java/org/geotools/data/wfs/protocol/http/AbstractHttpProtocol.java =================================================================== --- trunk/modules/unsupported/wfs/src/main/java/org/geotools/data/wfs/protocol/http/AbstractHttpProtocol.java 2010-03-29 13:45:48 UTC (rev 35132) +++ trunk/modules/unsupported/wfs/src/main/java/org/geotools/data/wfs/protocol/http/AbstractHttpProtocol.java 2010-03-29 13:50:29 UTC (rev 35133) @@ -21,7 +21,9 @@ import java.net.URL; import java.net.URLEncoder; import java.util.HashMap; +import java.util.Iterator; import java.util.Map; +import java.util.Map.Entry; import java.util.logging.Logger; import org.apache.commons.collections.map.CaseInsensitiveMap; @@ -34,7 +36,9 @@ * @author Gabriel Roldan (OpenGeo) * @version $Id$ * @since 2.6 - * @source $URL$ + * @source $URL: + * http://svn.osgeo.org/geotools/trunk/modules/unsupported/wfs/src/main/java/org/geotools + * /data/wfs/protocol/http/AbstractHttpProtocol.java $ * */ public abstract class AbstractHttpProtocol implements HTTPProtocol { @@ -102,7 +106,7 @@ protected String createUri(final URL baseUrl, final Map<String, String> queryStringKvp) { final String query = baseUrl.getQuery(); Map<String, String> finalKvpMap = new HashMap<String, String>(queryStringKvp); - if (query != null) { + if (query != null && query.length() > 0) { Map<String, String> userParams = new CaseInsensitiveMap(queryStringKvp); String[] rawUrlKvpSet = query.split("&"); for (String rawUrlKvp : rawUrlKvpSet) { @@ -142,7 +146,10 @@ String key, value; try { - for (Map.Entry<String, String> kvp : finalKvpMap.entrySet()) { + Entry<String, String> kvp; + for (Iterator<Map.Entry<String, String>> it = finalKvpMap.entrySet().iterator(); it + .hasNext();) { + kvp = it.next(); key = kvp.getKey(); value = kvp.getValue(); if (value == null) { @@ -153,7 +160,9 @@ sb.append(key); sb.append('='); sb.append(value); - sb.append('&'); + if (it.hasNext()) { + sb.append('&'); + } } } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); |