<NME> TempDirProviderImpl.java
<BEF> package stroom.util.io;

import stroom.util.logging.LambdaLogger;
import stroom.util.logging.LambdaLoggerFactory;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Optional;
import javax.inject.Inject;
import javax.inject.Singleton;

@Singleton
public class TempDirProviderImpl implements TempDirProvider {

    private static final LambdaLogger LOGGER = LambdaLoggerFactory.getLogger(TempDirProviderImpl.class);

    private final PathConfig pathConfig;
    private final HomeDirProvider homeDirProvider;

    private volatile Path tempDir;

    @Inject
    public TempDirProviderImpl(final PathConfig pathConfig,
                               final HomeDirProvider homeDirProvider) {
        // PathConfig is all RestartRequired so no need for a provider
        this.pathConfig = pathConfig;
        this.homeDirProvider = homeDirProvider;
    }
            Path path = null;

            String dir = pathConfig.getTemp();
            if (dir != null) {
                dir = FileUtil.replaceHome(dir);
                path = Paths.get(dir);
            }

            if (path == null) {
                throw new NullPointerException("Temp dir is null");
            }
            try {
                Files.createDirectories(path);
            } catch (IOException e) {
                        path.toAbsolutePath().normalize());
            }

            // If this isn't an absolute path then make it so relative to the home path.
            if (!path.isAbsolute()) {
                path = homeDirProvider.get()
                        .resolve(path);
            }

            path = path.toAbsolutePath();

            tempDir = path;
        }
        return tempDir;
    }

    private Optional<Path> getDefaultTempDir() {
        final String systemTempDirStr = System.getProperty("java.io.tmpdir");
        if (systemTempDirStr == null) {
            return Optional.empty();
        } else {
            final Path systemTempDir = Paths.get(systemTempDirStr);
            if (Files.isDirectory(systemTempDir)) {
                final String subDirName = pathConfig.getClass()
                        .getSimpleName()
                        .toLowerCase()
                        .contains("proxy")
                        ? "stroom-proxy"
                        : "stroom";

                final Path dir = Paths.get(systemTempDirStr).resolve(subDirName);
                LOGGER.info("Using system temp path {}", dir.toAbsolutePath().normalize());
                return Optional.of(dir);
            } else {
                LOGGER.debug("{} does not exist or is not a directory",
                        systemTempDir.toAbsolutePath().normalize());
                return Optional.empty();
            }
        }
    }

    public void setTempDir(final Path tempDir) {
        this.tempDir = tempDir;
    }
}

<MSG> gh-2350 Remove defaults for home/temp, handle empty str

<DFF> @@ -30,14 +30,23 @@ public class TempDirProviderImpl implements TempDirProvider {
             Path path = null;
 
             String dir = pathConfig.getTemp();
-            if (dir != null) {
+            if (dir != null && !dir.isEmpty()) {
                 dir = FileUtil.replaceHome(dir);
                 path = Paths.get(dir);
             }
 
+            if (path == null) {
+                final String systemTempDir = System.getProperty("java.io.tmpdir");
+                if (systemTempDir != null) {
+                    // i.e. /tmp/stroom
+                    path = Path.of(systemTempDir).resolve("stroom");
+                }
+            }
+
             if (path == null) {
                 throw new NullPointerException("Temp dir is null");
             }
+
             try {
                 Files.createDirectories(path);
             } catch (IOException e) {

{'addition_count': 10, 'commit_subject': 'gh-2350 Remove defaults for home/temp, handle empty str', 'deletion_count': 1, 'file_extension': '.java', 'lang': 'java', 'license': 'apache-2.0', 'repo_name': 'gchq/stroom'}