diff options
author | Thomas Wolf <thomas.wolf@paranor.ch> | 2017-08-23 11:50:05 +0200 |
---|---|---|
committer | Thomas Wolf <thomas.wolf@paranor.ch> | 2017-08-23 12:20:55 +0200 |
commit | 1b4daa2994a16bad5b9b77b24d8ce1f1d25f78fa (patch) | |
tree | f1454afe768b7cfb705d323b635572b73325f337 /org.eclipse.jgit.http.test | |
parent | 7ac1bfc834fe65b7e86e8f54f1f5025df90f8a92 (diff) | |
download | jgit-1b4daa2994a16bad5b9b77b24d8ce1f1d25f78fa.tar.gz 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.java | 8 |
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")); } } |