Fix lazy initialization of non-volatile static field in GerritLauncher
The `myHome` static member of GerritLauncher is lazy initialized in the `getHomeDirectory` method. According to FindBugs: Because the compiler or processor may reorder instructions, threads are not guaranteed to see a completely initialized object, if the method can be called by multiple threads. Fix this by declaring the member as 'volatile'. Change-Id: If2fd90ce83d5b383539aac41dddcacaca1729300
This commit is contained in:
@@ -302,7 +302,7 @@ public final class GerritLauncher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private volatile static File myArchive;
|
private volatile static File myArchive;
|
||||||
private static File myHome;
|
private volatile static File myHome;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locate the JAR/WAR file we were launched from.
|
* Locate the JAR/WAR file we were launched from.
|
||||||
|
Reference in New Issue
Block a user