summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.junit
diff options
context:
space:
mode:
authorChristian Halstrick <christian.halstrick@sap.com>2014-12-22 11:19:22 +0100
committerChristian Halstrick <christian.halstrick@sap.com>2014-12-22 15:19:09 +0100
commit3226e35db846bbb848c3fe62e3e435fae52a2d5b (patch)
treee246deb0627934e920003e3da91ed128f7d8fb6b /org.eclipse.jgit.junit
parentd49c9ee84840f76604242b1ddf6cd5e6b898bdfa (diff)
downloadjgit-3226e35db846bbb848c3fe62e3e435fae52a2d5b.tar.gz
jgit-3226e35db846bbb848c3fe62e3e435fae52a2d5b.zip
Fix junit tests under windows when the platform is explicitly changed
SystemReader used a chached ObjectChecker which was instantiated only once. But in case of unit tests where we can change the platform dynamically (e.g. MockSystemReader.setWindows()) this is wrong and caused DirCacheCheckoutMaliciousPathTest. testMaliciousAbsoluteCurDrivePathWindowsOnUnix() to fail. This change allows user of SystemReader to force the creation of a new ObjectChecker. MockSystemReader.setWindows() and .setUnix() make use of this feature. Change-Id: I87458d1dc63c1f5c18979f972b1c1f0d670a9ed8
Diffstat (limited to 'org.eclipse.jgit.junit')
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java2
1 files changed, 2 insertions, 0 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 3d21f9f8ad..65551d6579 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
@@ -184,6 +184,7 @@ public class MockSystemReader extends SystemReader {
setProperty("file.separator", "\\");
setProperty("path.separator", ";");
setProperty("line.separator", "\r\n");
+ setPlatformChecker();
}
/**
@@ -194,5 +195,6 @@ public class MockSystemReader extends SystemReader {
setProperty("file.separator", "/");
setProperty("path.separator", ":");
setProperty("line.separator", "\n");
+ setPlatformChecker();
}
}