Use Config.unset instead of setting to null

JGit's behavior around null values is ill-defined, particularly when
serializing/deserializing configs. Don't depend on setting null
actually working, and use unset instead.

Change-Id: I995bb9fedda9b012adb655f27b125a033e84c35f
This commit is contained in:
Dave Borowitz
2015-06-09 15:38:57 -07:00
parent b63e4398b5
commit 03f5a6bb4f
2 changed files with 2 additions and 2 deletions

View File

@@ -189,7 +189,7 @@ public class GerritServer {
cfg.setString("httpd", null, "listenUrl", url); cfg.setString("httpd", null, "listenUrl", url);
cfg.setString("sshd", null, "listenAddress", forceEphemeralPort); cfg.setString("sshd", null, "listenAddress", forceEphemeralPort);
cfg.setBoolean("sshd", null, "testUseInsecureRandom", true); cfg.setBoolean("sshd", null, "testUseInsecureRandom", true);
cfg.setString("cache", null, "directory", null); cfg.unset("cache", null, "directory");
cfg.setString("gerrit", null, "basePath", "git"); cfg.setString("gerrit", null, "basePath", "git");
cfg.setBoolean("sendemail", null, "enable", true); cfg.setBoolean("sendemail", null, "enable", true);
cfg.setInt("sendemail", null, "threadPoolSize", 0); cfg.setInt("sendemail", null, "threadPoolSize", 0);

View File

@@ -88,7 +88,7 @@ public class InMemoryModule extends FactoryModule {
cfg.setString("gerrit", null, "allProjects", "Test-Projects"); cfg.setString("gerrit", null, "allProjects", "Test-Projects");
cfg.setString("user", null, "name", "Gerrit Code Review"); cfg.setString("user", null, "name", "Gerrit Code Review");
cfg.setString("user", null, "email", "gerrit@localhost"); cfg.setString("user", null, "email", "gerrit@localhost");
cfg.setString("cache", null, "directory", null); cfg.unset("cache", null, "directory");
cfg.setString("index", null, "type", "lucene"); cfg.setString("index", null, "type", "lucene");
cfg.setBoolean("index", "lucene", "testInmemory", true); cfg.setBoolean("index", "lucene", "testInmemory", true);
cfg.setInt("index", "lucene", "testVersion", cfg.setInt("index", "lucene", "testVersion",