[JGIT PATCH 5/7] Include URIish in bundle transport within any TransportExceptions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This way the bundle path (as entered by the user) is reported as
part of the error.

Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
---
 .../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

--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux