aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2009-12-14 09:06:22 +0100
committerShawn O. Pearce <spearce@spearce.org>2009-12-21 16:36:53 -0800
commitd80569955ed4b38732aeb3dc88ffa99243002448 (patch)
tree37a94ee4f1ee0f33b90e3bf9fcea64a1822eb096 /org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
parent53f3632f604d50e2f37b2fed9a1476bb2b55bd22 (diff)
downloadjgit-d80569955ed4b38732aeb3dc88ffa99243002448.tar.gz
jgit-d80569955ed4b38732aeb3dc88ffa99243002448.zip
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>
Diffstat (limited to 'org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java')
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
index 87125d280c..306d432e63 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2009, Google Inc.
+ * Copyright (C) 2009, Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2009, Yann Simon <yann.simon.fr@gmail.com>
* and other copyright owners as documented in the project's IP log.
*
@@ -44,10 +45,12 @@
package org.eclipse.jgit.junit;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.TimeZone;
+import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileBasedConfig;
import org.eclipse.jgit.util.SystemReader;
@@ -63,7 +66,11 @@ public class MockSystemReader extends SystemReader {
init(Constants.GIT_AUTHOR_EMAIL_KEY);
init(Constants.GIT_COMMITTER_NAME_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) {