Backup and Restore may fail if java.io.tmpdir is not defined

Description

BackupUtils class needs to store temporary files in a temp folder. In order to do this it is now trying to do

Resource root = Resources.fromPath(System.getProperty("java.io.tmpdir", "."));

This causes an exception if the property "java.io.tmpdir" is null falling back to "."

java.lang.IllegalArgumentException: Contains invalid . path:
at org.geoserver.platform.resource.Paths.toPath(Paths.java:168)
at org.geoserver.platform.resource.Paths.path(Paths.java:114)
at org.geoserver.platform.resource.Paths.path(Paths.java:96)
at org.geoserver.platform.resource.FileSystemResourceStore$FileSystemResource.get(FileSystemResourceStore.java:422)

The proposed solution would be to make use of the GeoServer data dir temp folder if the System variable is not available.

GeoServer will WARNING the user about this since the GEOSERVER Data Dir temp folder may considerably increase in size.

Environment

None

Assignee

Alessio Fabiani

Reporter

Alessio Fabiani

Triage

None

Fix versions

None

Affects versions

None

Priority

Medium
Configure