aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/.settings/.api_filters8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/errors/NoRemoteRepositoryException.java15
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java11
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java16
4 files changed, 37 insertions, 13 deletions
diff --git a/org.eclipse.jgit/.settings/.api_filters b/org.eclipse.jgit/.settings/.api_filters
index 83a83817f4..acceac05df 100644
--- a/org.eclipse.jgit/.settings/.api_filters
+++ b/org.eclipse.jgit/.settings/.api_filters
@@ -8,6 +8,14 @@
</message_arguments>
</filter>
</resource>
+ <resource path="src/org/eclipse/jgit/transport/BasePackPushConnection.java" type="org.eclipse.jgit.transport.BasePackPushConnection">
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.transport.BasePackPushConnection"/>
+ <message_argument value="noRepository()"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/jgit/transport/ProtocolV2Hook.java" type="org.eclipse.jgit.transport.ProtocolV2Hook">
<filter id="404000815">
<message_arguments>
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/NoRemoteRepositoryException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/NoRemoteRepositoryException.java
index 58f70f5d4b..1dd976cec9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/NoRemoteRepositoryException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/NoRemoteRepositoryException.java
@@ -29,4 +29,19 @@ public class NoRemoteRepositoryException extends TransportException {
public NoRemoteRepositoryException(URIish uri, String s) {
super(uri, s);
}
+
+ /**
+ * Constructs an exception indicating a repository does not exist.
+ *
+ * @param uri
+ * URI used for transport
+ * @param s
+ * message
+ * @param cause
+ * root cause exception
+ * @since 5.13
+ */
+ public NoRemoteRepositoryException(URIish uri, String s, Throwable cause) {
+ super(uri, s, cause);
+ }
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java
index 3826bf7401..09c559d7b5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java
@@ -210,9 +210,7 @@ abstract class BasePackConnection extends BaseConnection {
try {
line = readLine();
} catch (EOFException e) {
- TransportException noRepo = noRepository();
- noRepo.initCause(e);
- throw noRepo;
+ throw noRepository(e);
}
if (line != null && VERSION_1.equals(line)) {
// Same as V0, except for this extra line. We shouldn't get
@@ -567,11 +565,14 @@ abstract class BasePackConnection extends BaseConnection {
*
* Subclasses may override this method to provide better diagnostics.
*
+ * @param cause
+ * root cause exception
* @return a TransportException saying a repository cannot be found and
* possibly why.
*/
- protected TransportException noRepository() {
- return new NoRemoteRepositoryException(uri, JGitText.get().notFound);
+ protected TransportException noRepository(Throwable cause) {
+ return new NoRemoteRepositoryException(uri, JGitText.get().notFound,
+ cause);
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java
index eb1d2ac0a9..b87a85d934 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java
@@ -139,7 +139,7 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen
/** {@inheritDoc} */
@Override
- protected TransportException noRepository() {
+ protected TransportException noRepository(Throwable cause) {
// Sadly we cannot tell the "invalid URI" case from "push not allowed".
// Opening a fetch connection can help us tell the difference, as any
// useful repository is going to support fetch if it also would allow
@@ -147,18 +147,18 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen
// URI is wrong. Otherwise we can correctly state push isn't allowed
// as the fetch connection opened successfully.
//
+ TransportException te;
try {
transport.openFetch().close();
- } catch (NotSupportedException e) {
- // Fall through.
+ te = new TransportException(uri, JGitText.get().pushNotPermitted);
} catch (NoRemoteRepositoryException e) {
// Fetch concluded the repository doesn't exist.
- //
- return e;
- } catch (TransportException e) {
- // Fall through.
+ te = e;
+ } catch (NotSupportedException | TransportException e) {
+ te = new TransportException(uri, JGitText.get().pushNotPermitted, e);
}
- return new TransportException(uri, JGitText.get().pushNotPermitted);
+ te.addSuppressed(cause);
+ return te;
}
/**