Constructor takes additionally URI argument, to add prefix: uri + ": " before real message. Now we don't have to remember about ugly (uri + ": ") prefix in each thrown message; Signed-off-by: Marek Zawirski <marek.zawirski@xxxxxxxxx> --- .../spearce/jgit/errors/PackProtocolException.java | 30 +++++++++++++++++++ .../spearce/jgit/errors/TransportException.java | 31 ++++++++++++++++++++ 2 files changed, 61 insertions(+), 0 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/errors/PackProtocolException.java b/org.spearce.jgit/src/org/spearce/jgit/errors/PackProtocolException.java index 525496a..7b5b4f6 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/errors/PackProtocolException.java +++ b/org.spearce.jgit/src/org/spearce/jgit/errors/PackProtocolException.java @@ -38,6 +38,7 @@ package org.spearce.jgit.errors; +import org.spearce.jgit.transport.URIish; /** * Indicates a protocol error has occurred while fetching/pushing objects. @@ -46,6 +47,35 @@ public class PackProtocolException extends TransportException { private static final long serialVersionUID = 1L; /** + * Constructs an PackProtocolException with the specified detail message + * prefixed with provided URI. + * + * @param uri + * URI used for transport + * @param s + * message + */ + public PackProtocolException(final URIish uri, final String s) { + super(uri + ": " + s); + } + + /** + * Constructs an PackProtocolException with the specified detail message + * prefixed with provided URI. + * + * @param uri + * URI used for transport + * @param s + * message + * @param cause + * root cause exception + */ + public PackProtocolException(final URIish uri, final String s, + final Throwable cause) { + this(uri + ": " + s, cause); + } + + /** * Constructs an PackProtocolException with the specified detail message. * * @param s diff --git a/org.spearce.jgit/src/org/spearce/jgit/errors/TransportException.java b/org.spearce.jgit/src/org/spearce/jgit/errors/TransportException.java index 7b378db..13c7a28 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/errors/TransportException.java +++ b/org.spearce.jgit/src/org/spearce/jgit/errors/TransportException.java @@ -40,6 +40,8 @@ package org.spearce.jgit.errors; import java.io.IOException; +import org.spearce.jgit.transport.URIish; + /** * Indicates a protocol error has occurred while fetching/pushing objects. */ @@ -47,6 +49,35 @@ public class TransportException extends IOException { private static final long serialVersionUID = 1L; /** + * Constructs an TransportException with the specified detail message + * prefixed with provided URI. + * + * @param uri + * URI used for transport + * @param s + * message + */ + public TransportException(final URIish uri, final String s) { + super(uri + ": " + s); + } + + /** + * Constructs an TransportException with the specified detail message + * prefixed with provided URI. + * + * @param uri + * URI used for transport + * @param s + * message + * @param cause + * root cause exception + */ + public TransportException(final URIish uri, final String s, + final Throwable cause) { + this(uri + ": " + s, cause); + } + + /** * Constructs an TransportException with the specified detail message. * * @param s -- 1.5.5.3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html