WebMapServer GetMapRequest method to set bounding box does not handle spaces

Description

When the following request is made the setBBox(...) method cannot contain any spaces:
WebMapServer wms = new .... etc.
GetMapRequest request = wms.createGetMapRequest();

request.setFormat("image/png");
request.setDimensions("600", "600");
request.setSRS("EPSG:4326");
request.setBBox("-180, -85.0511287798, 180, 85.011287798");

When there are blanks an Exception is thrown when the request is issued:
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1839)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)
at org.geotools.data.ows.SimpleHttpClient$SimpleHTTPResponse.<init>(SimpleHttpClient.java:171)
at org.geotools.data.ows.SimpleHttpClient.get(SimpleHttpClient.java:102)
at org.geotools.data.ows.AbstractOpenWebService.internalIssueRequest(AbstractOpenWebService.java:442)
at org.geotools.data.wms.WebMapServer.issueRequest(WebMapServer.java:439)

The URL works fine when sent via a browser. Here is an example of the URL:
http://ows.terrestris.de/osm/service?SERVICE=WMS&LAYERS=TOPO-OSM-WMS,TOPO-WMS,OSM-Overlay-WMS,OSM-WMS&FORMAT=image%2Fpng&HEIGHT=600&TRANSPARENT=TRUE&REQUEST=GetMap&BBOX=-180, -85.0511287798, 180, 85.011287798&WIDTH=600&STYLES=,,,&SRS=EPSG:4326&VERSION=1.1.1

Environment

Windows 7 Home Premium

Status

Assignee

Ian Turton

Reporter

Raj Hans

Triage

None

Components

Fix versions

Affects versions

Priority

Medium
Configure