diff options
4 files changed, 24 insertions, 9 deletions
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java index ef059bf2a3..61f272c4cd 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java @@ -175,7 +175,9 @@ public class HttpClientTests extends HttpTestCase { } catch (NoRemoteRepositoryException err) { String exp = uri + ": " + uri + "/info/refs?service=git-upload-pack not found"; - assertEquals(exp, err.getMessage()); + assertNotNull(err.getMessage()); + assertTrue("Unexpected error message", + err.getMessage().startsWith(exp)); } } } @@ -191,7 +193,9 @@ public class HttpClientTests extends HttpTestCase { } catch (NoRemoteRepositoryException err) { String exp = uri + ": " + uri + "/info/refs?service=git-upload-pack not found"; - assertEquals(exp, err.getMessage()); + assertNotNull(err.getMessage()); + assertTrue("Unexpected error message", + err.getMessage().startsWith(exp)); } } } diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties index 809bdf2865..ee5ba20b29 100644 --- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties +++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties @@ -755,8 +755,8 @@ updatingRefFailed=Updating the ref {0} to {1} failed. ReturnCode from RefUpdate. upstreamBranchName=branch ''{0}'' of {1} uriNotConfigured=Submodule URI not configured uriNotFound={0} not found +uriNotFoundWithMessage={0} not found: {1} URINotSupported=URI not supported: {0} -URLNotFound={0} not found userConfigFileInvalid=User config file {0} invalid {1} walkFailure=Walk failure. wantNotValid=want {0} not valid diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java index f3029bf3a1..7c29d4d13b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java @@ -816,8 +816,8 @@ public class JGitText extends TranslationBundle { /***/ public String upstreamBranchName; /***/ public String uriNotConfigured; /***/ public String uriNotFound; + /***/ public String uriNotFoundWithMessage; /***/ public String URINotSupported; - /***/ public String URLNotFound; /***/ public String userConfigFileInvalid; /***/ public String walkFailure; /***/ public String wantNotValid; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java index c08f400307..ee64a87f76 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java @@ -483,6 +483,18 @@ public class TransportHttp extends HttpTransport implements WalkTransport, this.headers = headers; } + private NoRemoteRepositoryException createNotFoundException(URIish u, + URL url, String msg) { + String text; + if (msg != null && !msg.isEmpty()) { + text = MessageFormat.format(JGitText.get().uriNotFoundWithMessage, + url, msg); + } else { + text = MessageFormat.format(JGitText.get().uriNotFound, url); + } + return new NoRemoteRepositoryException(u, text); + } + private HttpConnection connect(String service) throws TransportException, NotSupportedException { URL u = getServiceURL(service); @@ -511,8 +523,8 @@ public class TransportHttp extends HttpTransport implements WalkTransport, return conn; case HttpConnection.HTTP_NOT_FOUND: - throw new NoRemoteRepositoryException(uri, - MessageFormat.format(JGitText.get().uriNotFound, u)); + throw createNotFoundException(uri, u, + conn.getResponseMessage()); case HttpConnection.HTTP_UNAUTHORIZED: authMethod = HttpAuthMethod.scanResponse(conn, ignoreTypes); @@ -1180,9 +1192,8 @@ public class TransportHttp extends HttpTransport implements WalkTransport, return; case HttpConnection.HTTP_NOT_FOUND: - throw new NoRemoteRepositoryException(uri, - MessageFormat.format(JGitText.get().uriNotFound, - conn.getURL())); + throw createNotFoundException(uri, conn.getURL(), + conn.getResponseMessage()); case HttpConnection.HTTP_FORBIDDEN: throw new TransportException(uri, |