Fix potential null binding of sitePath
When '-d' parameter of site init program is not provided the setter of
sitePath variable is not called. This leads to binding null value to
Path object annotated with @SitePath.
Simple initialization of sitePath with Paths.get(".") fixes this issue
Bug: issue 3212
Change-Id: I009ac28c22e9c092709ac4448ff8fc3f49a64a8c
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
This commit is contained in:
committed by
David Pursehouse
parent
6dcf6712a5
commit
d6dc573586
@@ -74,7 +74,7 @@ public abstract class SiteProgram extends AbstractProgram {
|
||||
|
||||
protected Provider<DataSource> dsProvider;
|
||||
|
||||
private Path sitePath;
|
||||
private Path sitePath = Paths.get(".");
|
||||
|
||||
protected SiteProgram() {
|
||||
}
|
||||
@@ -193,7 +193,7 @@ public abstract class SiteProgram extends AbstractProgram {
|
||||
Module m = new AbstractModule() {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(Path.class).annotatedWith(SitePath.class).toInstance(sitePath);
|
||||
bind(Path.class).annotatedWith(SitePath.class).toInstance(getSitePath());
|
||||
bind(SitePaths.class);
|
||||
}
|
||||
};
|
||||
@@ -225,7 +225,7 @@ public abstract class SiteProgram extends AbstractProgram {
|
||||
modules.add(new AbstractModule() {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(Path.class).annotatedWith(SitePath.class).toInstance(sitePath);
|
||||
bind(Path.class).annotatedWith(SitePath.class).toInstance(getSitePath());
|
||||
}
|
||||
});
|
||||
modules.add(new GerritServerConfigModule());
|
||||
|
||||
Reference in New Issue
Block a user