git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[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
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 6 of 8 in “Misc. RevWalk, bundle transport improvements”
  1. 0/7 Misc. RevWalk, bundle transport improvementsShawn O. Pearce, Sep 4, 2008
  2. 1/7 Cleanup RevWalk.parseCommit, parseTree to not throw ClassCastExceptionShawn O. Pearce, Sep 4, 2008
  3. 2/7 Cleanup RevWalk.parseTree semanticsShawn O. Pearce, Sep 4, 2008
  4. 3/7 Fix potential NullPointerException in RevWalk.parseTreeShawn O. Pearce, Sep 4, 2008
  5. 4/7 Add prerequisite verification to the bundle transportShawn O. Pearce, Sep 4, 2008
  6. 5/7 Include URIish in bundle transport within any TransportExceptionsShawn O. Pearce, Sep 4, 2008
  7. 6/7 Refactor TransportBundle to not be dependent on FileInputStreamShawn O. Pearce, Sep 4, 2008
  8. 7/7 Refactor bundle transport to permit streaming from applicationShawn O. Pearce, Sep 4, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.