[JGIT PATCH 5/7] Include URIish in bundle transport within any TransportExceptions
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Sep 4, 2008, 23:42 UTC
- Message-ID
- <1220571739-4219-6-git-send-email-spearce@spearce.org>
- In-Reply-To
- <1220571739-4219-5-git-send-email-spearce@spearce.org>
This way the bundle path (as entered by the user) is reported as part of the error.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org> --- .../spearce/jgit/transport/TransportBundle.java | 21 ++++++++----------- 1 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/TransportBundle.java b/org.spearce.jgit/src/org/spearce/jgit/transport/TransportBundle.java index e502619..de62fb8 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/transport/TransportBundle.java +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/TransportBundle.java @@ -128,7 +128,7 @@ BundleFetchConnection() throws TransportException { in = new FileInputStream(bundle); bin = new RewindBufferedInputStream(in); } catch (FileNotFoundException err) { - throw new TransportException(bundle.getPath() + ": not found"); + throw new TransportException(uri, "not found"); } try { @@ -137,8 +137,7 @@ BundleFetchConnection() throws TransportException { readBundleV2(); break; default: - throw new TransportException(bundle.getPath() - + ": not a bundle"); + throw new TransportException(uri, "not a bundle"); } in.getChannel().position( @@ -149,12 +148,10 @@ BundleFetchConnection() throws TransportException { throw err; } catch (IOException err) { close(); - throw new TransportException(bundle.getPath() + ": " - + err.getMessage(), err); + throw new TransportException(uri, err.getMessage(), err); } catch (RuntimeException err) { close(); - throw new TransportException(bundle.getPath() + ": " - + err.getMessage(), err); + throw new TransportException(uri, err.getMessage(), err); } } @@ -162,7 +159,7 @@ private int readSignature() throws IOException { final String rev = readLine(new byte[1024]); if (V2_BUNDLE_SIGNATURE.equals(rev)) return 2; - throw new TransportException(bundle.getPath() + ": not a bundle"); + throw new TransportException(uri, "not a bundle"); } private void readBundleV2() throws IOException { @@ -189,8 +186,8 @@ private void readBundleV2() throws IOException { } private PackProtocolException duplicateAdvertisement(final String name) { - return new PackProtocolException("duplicate advertisements of " - + name); + return new PackProtocolException(uri, + "duplicate advertisements of " + name); } private String readLine(final byte[] hdrbuf) throws IOException { @@ -217,10 +214,10 @@ protected void doFetch(final ProgressMonitor monitor, ip.renameAndOpenPack(); } catch (IOException err) { close(); - throw new TransportException(err.getMessage(), err); + throw new TransportException(uri, err.getMessage(), err); } catch (RuntimeException err) { close(); - throw new TransportException(err.getMessage(), err); + throw new TransportException(uri, err.getMessage(), err); } }
-- 1.6.0.1.319.g9f32b