Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2017-08-23 09:50:05 +0000
committerThomas Wolf2017-08-23 10:20:55 +0000
commit1b4daa2994a16bad5b9b77b24d8ce1f1d25f78fa (patch)
treef1454afe768b7cfb705d323b635572b73325f337 /org.eclipse.jgit.http.test
parent7ac1bfc834fe65b7e86e8f54f1f5025df90f8a92 (diff)
downloadjgit-1b4daa2994a16bad5b9b77b24d8ce1f1d25f78fa.tar.gz
jgit-1b4daa2994a16bad5b9b77b24d8ce1f1d25f78fa.tar.xz
jgit-1b4daa2994a16bad5b9b77b24d8ce1f1d25f78fa.zip
Cleanup: message reporting for HTTP redirect handling
The addition of "tooManyRedirects" in commit 7ac1bfc ("Do authentication re-tries on HTTP POST") was an error I didn't catch after rebasing that change. That message had been renamed in the earlier commit e17bfc9 ("Add support to follow HTTP redirects") to "redirectLimitExceeded". Also make sure we always use the TransportException(URIish, ...) constructor; it'll prefix the message given with the sanitized URI. Change messages to remove the explicit mention of that URI inside the message. Adapt tests that check the expected exception message text. For the info logging of redirects, remove a potentially present password component in the URI to avoid leaking it into the log. Change-Id: I517112404757a9a947e92aaace743c6541dce6aa Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit.http.test')
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
index 1b0c6949a9..51b79903c6 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
@@ -595,9 +595,9 @@ public class SmartClientSmartServerTest extends HttpTestCase {
t.fetch(NullProgressMonitor.INSTANCE, mirror(master));
fail("Should have failed (too many redirects)");
} catch (TransportException e) {
- String expectedMessageBegin = MessageFormat.format(
- JGitText.get().redirectLimitExceeded, remoteUri, "3",
- remoteUri.replace("/4/", "/1/") + '/', "");
+ String expectedMessageBegin = remoteUri.toString() + ": "
+ + MessageFormat.format(JGitText.get().redirectLimitExceeded,
+ "3", remoteUri.replace("/4/", "/1/") + '/', "");
String message = e.getMessage();
if (message.length() > expectedMessageBegin.length()) {
message = message.substring(0, expectedMessageBegin.length());
@@ -616,7 +616,7 @@ public class SmartClientSmartServerTest extends HttpTestCase {
t.fetch(NullProgressMonitor.INSTANCE, mirror(master));
fail("Should have failed (redirect loop)");
} catch (TransportException e) {
- assertTrue(e.getMessage().contains("redirected more than"));
+ assertTrue(e.getMessage().contains("Redirected more than"));
}
}

Back to the top