Don't crash if we try to load the config for a MockSystemReader
Instead do nothing. For now, save() will fail and the config file is set to null, which may surprise some calling tests. Change-Id: I1c65f8b1131569da01b4ef33678d813565521fbb Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
parent
53f3632f60
commit
d80569955e
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2009, Google Inc.
|
* Copyright (C) 2009, Google Inc.
|
||||||
|
* Copyright (C) 2009, Robin Rosenberg <robin.rosenberg@dewire.com>
|
||||||
* Copyright (C) 2009, Yann Simon <yann.simon.fr@gmail.com>
|
* Copyright (C) 2009, Yann Simon <yann.simon.fr@gmail.com>
|
||||||
* and other copyright owners as documented in the project's IP log.
|
* and other copyright owners as documented in the project's IP log.
|
||||||
*
|
*
|
||||||
|
@ -44,10 +45,12 @@
|
||||||
|
|
||||||
package org.eclipse.jgit.junit;
|
package org.eclipse.jgit.junit;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
import org.eclipse.jgit.errors.ConfigInvalidException;
|
||||||
import org.eclipse.jgit.lib.Constants;
|
import org.eclipse.jgit.lib.Constants;
|
||||||
import org.eclipse.jgit.lib.FileBasedConfig;
|
import org.eclipse.jgit.lib.FileBasedConfig;
|
||||||
import org.eclipse.jgit.util.SystemReader;
|
import org.eclipse.jgit.util.SystemReader;
|
||||||
|
@ -63,7 +66,11 @@ public MockSystemReader() {
|
||||||
init(Constants.GIT_AUTHOR_EMAIL_KEY);
|
init(Constants.GIT_AUTHOR_EMAIL_KEY);
|
||||||
init(Constants.GIT_COMMITTER_NAME_KEY);
|
init(Constants.GIT_COMMITTER_NAME_KEY);
|
||||||
init(Constants.GIT_COMMITTER_EMAIL_KEY);
|
init(Constants.GIT_COMMITTER_EMAIL_KEY);
|
||||||
userGitConfig = new FileBasedConfig(null);
|
userGitConfig = new FileBasedConfig(null) {
|
||||||
|
@Override
|
||||||
|
public void load() throws IOException, ConfigInvalidException {
|
||||||
|
// Do nothing
|
||||||
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init(final String n) {
|
private void init(final String n) {
|
||||||
|
|
Loading…
Reference in New Issue