aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/errors
diff options
context:
space:
mode:
authorChristian Halstrick <christian.halstrick@sap.com>2015-04-23 15:24:25 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2015-05-27 23:52:53 +0200
commit261b514ceb4271275d7ea68b20eee109442e0af4 (patch)
treeddfd55fdcb9a6c23f1b38b3b44a0612447a7d1fe /org.eclipse.jgit/src/org/eclipse/jgit/errors
parentb8c8008115e0c48d3d844af1dc858c700a9428e4 (diff)
downloadjgit-261b514ceb4271275d7ea68b20eee109442e0af4.tar.gz
jgit-261b514ceb4271275d7ea68b20eee109442e0af4.zip
Better report too large pack-files from PushCommand
JGits PushCommand and BasePackPushConnection were throwing generic TransportExceptions when the pushed pack-file was rejected by the server since it was too big. Let JGit better interprete the server's response to detect this situation and throw a more specific exception. This detection works by parsing the status line sent by the server. This change only recognizes the response sent by a JGit based server. All other servers which report such problems in a different way still lead to a generic TransportExceptions. Change-Id: Ic075764ea152939ce72c446252464620dd54edea Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/errors')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/errors/TooLargePackException.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/TooLargePackException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/TooLargePackException.java
index 5cf0f802c1..d54798541d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/TooLargePackException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/TooLargePackException.java
@@ -43,17 +43,17 @@
package org.eclipse.jgit.errors;
-import java.io.IOException;
import java.text.MessageFormat;
import org.eclipse.jgit.internal.JGitText;
+import org.eclipse.jgit.transport.URIish;
/**
* Thrown when a pack exceeds a given size limit
*
* @since 3.3
*/
-public class TooLargePackException extends IOException {
+public class TooLargePackException extends TransportException {
private static final long serialVersionUID = 1L;
/**
@@ -66,4 +66,17 @@ public class TooLargePackException extends IOException {
super(MessageFormat.format(JGitText.get().receivePackTooLarge,
Long.valueOf(packSizeLimit)));
}
+
+ /**
+ * Construct a too large pack exception.
+ *
+ * @param uri
+ * URI used for transport
+ * @param s
+ * message
+ * @since 4.0
+ */
+ public TooLargePackException(URIish uri, String s) {
+ super(uri.setPass(null) + ": " + s); //$NON-NLS-1$
+ }
}