[Geoserver-devel] [JIRA] (GEOS-8796) GeorecifyCoverage fails to handle paths with spaces

Ben Caradoc-Davies created an issue

GeoServer / BugGEOS-8796

GeorecifyCoverage fails to handle paths with spaces

Issue Type:

BugBug

Affects Versions:

2.12.4, 2.14-beta, 2.13.1

Assignee:

Ben Caradoc-Davies

Components:

WPS

Created:

22/Jun/18 1:07 AM

Priority:

MediumMedium

Reporter:

Ben Caradoc-Davies

GeorecifyCoverage constructs gdal_translate command lines as strings without any consideration of arguments such as filenames containing spaces that might require quoting.

For example, building with -Djava.io.tmpdir=target in a path with spaces fails:

Tests in error: 
  testGeorectify(org.geoserver.wps.gs.GeorectifyCoverageTest): Error launching OS command: 'gdal_translate' with arguments '-of VRT  -gcp 183 33 -74.01183158 40.70852996 -gcp 103 114 -74.01083751 40.70754684 -gcp 459 298 -74.00857344 40.71194565 -gcp 252 139 -74.01053024 40.70938712  /home/ben/geoserver/src with spaces/geoserver/src/extension/wps/wps-core/target/readCoverage6331435335797481973.tif /home/ben/geoserver/src with spaces/geoserver/src/extension/wps/wps-core/target/vrt_4681318640566863810.vrt' and env vars 'null': (..)

Rather than trying to add argument quoting and then preserve it through String split and join operations, a better approach is pass arguments lists as List<String> and let ProcessBuilder do all the argument quoting. This is a more idiomatic use of ProcessBuilder.

Add Comment

Add Comment

Get Jira notifications on your phone! Download the Jira Cloud app for Android or iOS


This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100087-sha1:2bba7fe)

Atlassian logo