Browse Source

Fix NPE in SystemReader in tests

SystemReader.updateAll() must _not_ test whether the file exists. In
tests at least there are FileBasedConfigs with a null file. Test
configs should (and do) override isOutdated() to deal with this case.

Change-Id: I56303fe0d56afeb9f2203ee807a92c5dcf3809e9
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
stable-5.5
Thomas Wolf 5 years ago
parent
commit
22e153177c
  1. 3
      org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java

3
org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java

@ -428,9 +428,6 @@ public abstract class SystemReader {
updateAll(config.getBaseConfig()); updateAll(config.getBaseConfig());
if (config instanceof FileBasedConfig) { if (config instanceof FileBasedConfig) {
FileBasedConfig cfg = (FileBasedConfig) config; FileBasedConfig cfg = (FileBasedConfig) config;
if (!cfg.getFile().exists()) {
return;
}
if (cfg.isOutdated()) { if (cfg.isOutdated()) {
LOG.debug("loading config {}", cfg); //$NON-NLS-1$ LOG.debug("loading config {}", cfg); //$NON-NLS-1$
cfg.load(); cfg.load();

Loading…
Cancel
Save