Fix lazy initialization of non-volatile static field in GerritLauncher
The `myArchive` static member of GerritLauncher is lazy initialized in the `getDistributionArchive` 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: I2774cc12c2ee749331f72ff83c3d317b073787f3
This commit is contained in:
@@ -299,7 +299,7 @@ public final class GerritLauncher {
|
||||
return name;
|
||||
}
|
||||
|
||||
private static File myArchive;
|
||||
private volatile static File myArchive;
|
||||
|
||||
/**
|
||||
* Locate the JAR/WAR file we were launched from.
|
||||
|
Reference in New Issue
Block a user