Fix NPE when `./gradlew run` without `--data-dir` (#50421) (#50425)

This commit is contained in:
Rory Hunter 2019-12-20 20:25:58 +00:00 committed by Mark Vieira
parent 27ae9a1435
commit 1ec89f75dc
1 changed files with 3 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package org.elasticsearch.gradle.testclusters;
import org.gradle.api.logging.Logger; import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging; import org.gradle.api.logging.Logging;
import org.gradle.api.tasks.Input; import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.TaskAction;
import org.gradle.api.tasks.options.Option; import org.gradle.api.tasks.options.Option;
@ -49,7 +50,9 @@ public class RunTask extends DefaultTestClustersTask {
} }
@Input @Input
@Optional
public String getDataDir() { public String getDataDir() {
if (dataDir == null) { return null;}
return dataDir.toString(); return dataDir.toString();
} }