InitPluginStepsLoader: Ignore files prefixed .next_ and .last_

These files are ignored by PluginLoader when loading plugins in a
running site, but were not ignored when initializing a site.

As a result, if any of these files existing in /plugins had an init
step, the init step would be executed. This caused init to fail if
for example it was built against an incompatible Gerrit API version.

Change-Id: I03a2e0b9c730aaedc0b6899102b1f2f8ee17bbc4
This commit is contained in:
David Pursehouse
2016-06-30 18:12:01 +09:00
parent adfeb643a2
commit 56e34e7122

View File

@@ -122,7 +122,10 @@ public class InitPluginStepsLoader {
DirectoryStream.Filter<Path> filter = new DirectoryStream.Filter<Path>() {
@Override
public boolean accept(Path entry) throws IOException {
return entry.getFileName().toString().endsWith(".jar")
String name = entry.getFileName().toString();
return name.endsWith(".jar")
&& !name.startsWith(".last_")
&& !name.startsWith(".next_")
&& Files.isRegularFile(entry);
}
};